Hi,
Thank you for posting this here and sending the files.
I took a look at both the gep and xls files you sent and there's an error in your transcription of the Sub-ET2 code into Excel. The original code in C++ is:
y = log(gepMax2(tanh(d[9]),(G2C1-((d[27]+(((d[24]+d[21])/2.0)*d[3]))/2.0))));
And your Excel code is:
=LN((MAX((TANH(D7)),(-6.04296126895962-(AVERAGE(H7,((AVERAGE(G7,F7)))))))))
But it should be (you missed the C7 when you introduced the AVERAGE function):
=LN(MAX(TANH(D7),(-6.04296126895962-((H7+(((G7+F7)/2)*C7))/2))))
This code returns 7.376038623 both in Excel and in GeneXproTools and also in Excel VBA when you do Ensemble Deployment to Excel. So I'm guessing the R code is also correct.
gepModel <- function(d)
{
G1C7 <- 1.40720706472976
G2C1 <- -6.04296126895962
G3C4 <- 3.54960783715323
y <- 0.0
y <- gep3Rt(((d[3]+(atan(exp(G1C7))-log(d[17])))/2.0))
y <- y + log(max(tanh(d[10]),(G2C1-((d[28]+(((d[25]+d[22])/2.0)*d[4]))/2.0))))
y <- y + (d[2]*(atan(d[3])/G3C4))
return (y)
}
gep3Rt <- function(x)
{
return (if (x < 0.0) (-((-x) ^ (1.0/3.0))) else (x ^ (1.0/3.0)))
}
#######################################################################################
NumericTests <- function(name, dataPath, modelFunction)
{
print (paste("Starting ", name , "... "))
data <- read.table(dataPath, header=TRUE)
counter = 1
hasErrors = FALSE
for (index in 1:nrow(data))
{
row = data[index, ];
v <- as.vector(as.matrix(row))
result <- modelFunction(v)
expected <- tail(v, 1)
if (abs(result - expected) > 0.0000001)
{
print(paste("WRONG record " , counter, " = ", result))
hasErrors = TRUE
}
counter = counter +1
}
if (counter <= 1)
{
print("NOTHING PROCESSED")
}
if (hasErrors)
{
print(paste(name , " finished with ERRORS."))
}
else
{
print(paste(name , " finished without errors."))
}
}
NumericTests("gepModel", "C:\\SupportTests.txt", gepModel)
It looks like you're new here. If you want to get involved, click one of these buttons!