Hi, I'm running a calculation in two ways. The first way is to employ
vectors and evaluate a function in one go. The second way is to break
down the function into pieces and combine the pieces to the final
answer.

Algebraically, they should give me the same result. But the final
vector differs significantly. I must be missing something very
obvious, but I just cannot see it

xx <- c(-9.56305825951348, -8.20220288142583, -6.84134750333818,
-5.48049212525052,
        -4.11963674716287)
params <- structure(c(-7.9292094394, 4.9549173134, 4.738588416, 101.5743644892
                     ), .Names = c("LOG_AC50", "HILL_COEF",
"INF_ACTIVITY", "ZERO_ACTIVITY"
                          ))
yy <- params[4] + (params[3] - params[4])/(1 + 10^(params[1]-xx)^params[2])

t1 <-  10^(params[1]-xx)
t2 <- params[3] - params[4]
t3 <- (1+t1)^params[2]
t4 <- t2/t3;
t5 <- params[4] + t4

I would've expected yy and t5 to be the same; yet they are not

-- 
Rajarshi Guha | http://blog.rguha.net
NIH Center for Advancing Translational Science

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to