Hello all,
I'm trying to establish some confidence intervals on predictions I am making 
using 

>predict(nls(...))

and predict.nls (unfortunately) does not utilize the se.fit option. A little 
more background is that I am trying to match the output with older SAS routines 
to maintain consistency. Because predict.nls does not provide se's for 
individual predictions, I have been using a method suggested on r-help 
previously (by P. Dalgaard) using deriv() and vcov().  Specifically,

se.fit<-sqrt(apply(gradient, 1, function(x)
                sum(vcov(myNLSmodel)*outer(x,x))))

where I determine "gradient" by using deriv() and the points for which I am 
making the predictions.  This works for predicting the confidence interval for 
the mean predicted Y, however, I need the confidence interval for the 
individual predicted Y. According to the stats text I looked at, I need to 
change the above formula to 

se.fit<-sqrt(apply(gradient, 1, function(x)
                sum(vcov(myNLSmodel)*outer(x,x))+NEWTERM)) 

where NEWTERM is

NEWTERM<-myNLSmodel$m$deviance()/(nObservations - nParameters)

So the problem is that while the confidence intervals are close to those 
provided by SAS, they are always smaller. This, in the end, makes a large 
difference for the application. Can anyone suggest how I might make the 
confidence intervals I calculate in R match up with those of SAS for nls?

Thanks in advance,
Ben Ridenhour


 
________________________________
Benjamin Ridenhour
Centers for Disease Control & Prevention
Atlanta, GA 30329
"If we knew what we were doing,
     it wouldn't be research."
     --Einstein
        [[alternative HTML version deleted]]

______________________________________________
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