[Rd] evaluating variance functions in nlme

Nicholas Lewin-Koh nikko at hailmail.net
Tue Jul 26 21:56:41 CEST 2005


Hi,
I guess this is a final plea, and maybe this should go to R-help but
here goes.
I am writing a set of functions for calibration and prediction, and to
calculate standard 
errors and intervals I need the variance function to be evaluated at new
prediction points.
So for instance

fit<-gnls(Y~SSlogis(foo,Asym,xmid,scal),weights=varPower())
fit2<-gnls(Y~SSlogis(foo,Asym,xmid,scal),weights=varPower(form=~foo))

Now using fit or fit2 I would like to get the variance function
evaluated at new points. 
I have played with getCovariateFormula, and looked at Initialize.gnls,
summary etc.
but it is not clear to me how to evaluate the form component, especially
in the case of fit
above where form=~fitted(.), in any safe way.

I can grep for "fitted" in the formula eg.
grep("fitted",deparse(getCovariateFormula(fit$modelStruct$varFunc)))
and try to calculate predicted values from the model for the new points
but how to substitute back in the new terms?

I don't need this problem solved on a platter, I just need to unedrstand
an approach,
because my stabs are failing.

Thanks

Nicholas



More information about the R-devel mailing list