[R] lme, nlsList, nlsList.selfStart

From: Patrick Giraudoux <patrick.giraudoux_at_univ-fcomte.fr>
Date: Sun 12 Feb 2006 - 18:44:24 EST


Dear listers,

I am trying to fit a model using nlsList() using alternately a SSfol() selfstart function or its developped equivalent formulae.

This preliminary trial works well

mydata<-groupedData(Conc~Tps|Organ,data=mydata) mymod1<-nls(Conc~SSfol(Dose,Tps,lKe,lKa,lCl),data=mydata)

as well as a developped form:

mymod2<-nls(Conc~Dose * exp(lKe+lKa-lCl) *
(exp(-exp(lKe)*Tps)-exp(-exp(lKa)*Tps)) /(exp(lKa)-exp(lKe)),

    data=mydata,
    start= c(lKe=-2.77, lKa=-1.41, lCl=-1.13)     )

However when trying to fit the model with nlsList, I get:

mymod3<-nlsList(Conc~Dose * exp(lKe+lKa-lCl) *
(exp(-exp(lKe)*Tps)-exp(-exp(lKa)*Tps)) /(exp(lKa)-exp(lKe)),

     data=mydata,
     start= c(lKe=-2.77, lKa=-1.41, lCl=-1.13)
     )

Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :

        variable lengths differ
Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :

        variable lengths differ
Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :

        variable lengths differ

Or specifying the grouping factor explicitely:

mymod3<-nlsList(Conc~Dose * exp(lKe+lKa-lCl) *
(exp(-exp(lKe)*Tps)-exp(-exp(lKa)*Tps)) /(exp(lKa)-exp(lKe))|Organ,

     data=mydata,
     start= c(lKe=-2.77, lKa=-1.41, lCl=-1.13)
     )

Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :

        variable lengths differ
Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :

        variable lengths differ
Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :

        variable lengths differ

I cannot find out why the grouping factor cannot be used (it has the same length as the other variables...)

Another strange thing occurs: in the example given in the help of nlsList.selfstart, the following command works well:

 fm1 <- nlsList(SSasympOff, CO2)

However its seemingly equivalent applied to the case above fails:

mymod4<-nlsList(SSfol,data=mydata)
Error in eval(expr, envir, enclos) : object "input" not found
Error in eval(expr, envir, enclos) : object "input" not found
Error in eval(expr, envir, enclos) : object "input" not found


Any hint/suggestion appreciated.

Kind regards,

Patrick Giraudoux



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 Received on Sun Feb 12 18:48:55 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:27 EST