Nicholas Lewin-Koh
2005-Jul-19 16:15 UTC
[Rd] extracting and manipulating components from nlme and gnls objects
Hello, I am writing a set of functions to do prediction and calibration intervals for at least the subset of selfstarting models if not some more general ones. I need to be able to extract the varFunction from a fit object and evaluate it at a predicted point. Are there any examples around? Also in a self start model, say SSlogis, how would I get the gradient at a point? Thanks Nicholas PS I am sure I will have more questions
Douglas Bates
2005-Jul-19 16:48 UTC
[Rd] extracting and manipulating components from nlme and gnls objects
On 7/19/05, Nicholas Lewin-Koh <nikko at hailmail.net> wrote:> Hello, > I am writing a set of functions to do prediction and calibration > intervals > for at least the subset of selfstarting models if not some more general > ones. > > I need to be able to extract the varFunction from a fit object > and evaluate it at a predicted point. Are there any examples around? > > Also in a self start model, say SSlogis, how would I get the gradient > at a point?I think that the output of example(SSlogis) should answer that question for you.
Nicholas Lewin-Koh
2005-Jul-19 17:32 UTC
[Rd] extracting and manipulating components from nlme and gnls objects
Hi, Yes, I looked more carefully at the code and realized the parameters have to be named and then the gradient is returned so that SSlogis(3.4,4,5,6) does not return the gradient as an attribute but Asym<-4 xmid<-5 scal<-6 SSlogis(3.4,Asym,xmid,scal) does. However what I am finding more vexing is if I fit a model, say fit<-gnls(resp~SSlogis(covar,Asym,xmid,scal), data=foo, weights=varPower()) and I want to evaluate the arbitrary variance function at a new x, x0 then how do i get the variance function from the fit object and evaluate it at f(x0,..)? So far I can predict at x0 using predict(fit, newdata=list(covar=x0)) to get the fitted value but how to I plug that in to the varStruct stored in fit$modelStruct? Thanks Nicholas On Tue, 19 Jul 2005 11:48:18 -0500, "Douglas Bates" <dmbates at gmail.com> said:> On 7/19/05, Nicholas Lewin-Koh <nikko at hailmail.net> wrote: > > Hello, > > I am writing a set of functions to do prediction and calibration > > intervals > > for at least the subset of selfstarting models if not some more general > > ones. > > > > I need to be able to extract the varFunction from a fit object > > and evaluate it at a predicted point. Are there any examples around? > > > > Also in a self start model, say SSlogis, how would I get the gradient > > at a point? > > I think that the output of > > example(SSlogis) > > should answer that question for you.