Dear list,
I have encountered a problem with predict.nls (Windows XP, R.2.5.0), but I am 
not sure if it is a bug... 
 
On the nls man page, an example is:
 
DNase1 <- subset(DNase, Run == 1)
fm2DNase1 <- nls(density ~ 1/(1 + exp((xmid - log(conc))/scal)),
                 data = DNase1,
                 start = list(xmid = 0, scal = 1))
                 alg = "plinear", trace = TRUE)

Now consider prediction:
 
> predict(fm2DNase1)
 [1] 0.001424337 0.001424337 0.028883648 0.028883648 .....

> predict(fm2DNase1,newdata=fm2DNase1)
Error in if (sum(wrong) == 1) stop(gettextf("variable '%s' was fitted with 
class \"%s\" but class \"%s\" was supplied",  : 
        missing value where TRUE/FALSE needed
 
What causes the trouble is the call to .checkMFClasses(cl, newdata) in 
predict.nls.
 
 
Incidently, on the predict.nls page the example works:
 
> fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
> predict(fm)              
[1]  7.887449 12.524977 15.251673 16.854870 17.797490 18.677580
> predict(fm,newdata=BOD)              
[1]  7.887449 12.524977 15.251673 16.854870 17.797490 18.677580
attr(,"gradient")
             A      lrc
[1,] 0.4120369 5.977499
[2,] 0.6542994 7.029098
....
 
Is there a bug, or am I overlooking something??
 
Regards
Søren
 

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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