[R] Generalized least squares using "gnls" function

Ravi Varadhan rvaradha at jhsph.edu
Wed Jan 14 22:11:22 CET 2004


I have data from an assay in the form of two vectors, one is response 
and the other is a predictor. When I attempt to fit a 5 parameter 
logistic model with "nls", I get converged parameter estimates. I also 
get the same answers with "gnls" without specifying the "weights" 

However, when I attempt to use the "gnls" function and try to estimate 
the variance function, as a power function, I get the following error 

> ans51g <- gnls(log(b51) ~ p0 + p1/(1 + exp(-(log(dose)-p2)/p3))^p4, 
Error in eval(expr, envir, enclos) : Object "." not found

What am I doing wrong here and how can I do a GLS analysis with a 
variance function that is estimated from the data?

Here is my data:

> b51 <- c(17447.60674, 7060.37234, 2872.53012,  796.40426,  
454.47222,  260.22340,  120.11905,    83.40196,  51.45745,    
36.87912,  26.73256,    25.18681, 17.97674)
> dose <- c( 1.000000e+04, 1.000000e+03, 2.500000e+02, 6.250000e+01, 
3.125000e+01,  1.562500e+01, 7.812500e+00, 3.906250e+00, 
1.953125e+00, 9.765625e-01, 4.882813e-01, 2.441406e-01, 1.000000e-03)

thanks for the help,

More information about the R-help mailing list