Re: [R] lme, nlsList, nlsList.selfStart

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Fri 17 Feb 2006 - 12:12:31 EST

          Regarding the following:

 > 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

	  This example is NOT self contained and is entirely too complicated 
for me to try to replicate it myself in a reasonable period of time. I will therefore ask one short question: Are all the variable names in the "nlsList" call either columns of "mydata" or parameters to be estimated and therefore spelled out in "start"? If I were you, I'd check this all very carefully, being especially careful about the distinction between "lCl" and "lC1", in particular.

          If you'd like further help with this, I suggest you try to find the simplest possible example that generates problem you don't understand, then try to recast that example into one that is completely self contained, either a data set in the standard R or nlme distribution or numbers that one can generate with a very few lines of code. If you use random numbers, please "set.seed", to increase your confidence that someone else will see what you see. (And please review the posting guide! "www.R-project.org/posting-guide.html". Doing so may increase your chances of getting more useful information more quickly.)

          spencer graves

Patrick Giraudoux wrote:

> 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



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 Fri Feb 17 12:17:04 2006

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