Dear all

I finally found the way to do it. Nlme accepts simpler functions than
selfStart:

# Defining my function
Myfun <-function(x1,x2,Tmax,Topt,B,E) {
(((Tmax-x1)/(Tmax-Topt))*(x1/Topt)^(Topt/(Tmax-Topt)))*exp(-exp(B*(log(x2)-log(abs(E)))))
}

# Calling nlme
nlmefit3 <- nlme( y ~ Myfun(x1,x2,Tmax,Topt,B,E), data, fixed=Tmax+Topt+B+E
~ 1, random=Tmax+Topt+B+E ~ 1, start=list(fixed=(c(Topt=25.206, Tmax=36.085,
B=-0.825, E=6.435))) )

Unfortunately, in with nlmer I'm stuck with the error message "gradient
attribute of evaluated model must be a numeric matrix", but it's good that
it works with nlme.



Sebastien Guyader wrote:
> 
> Hello,
> 
> I'm trying to adjust a non linear model in which the biological response
> variable (ratio of germinated fungus spores) is dependent on 2 covariates
> (temperature and time). The response to temperature is modeled by a kind
> of beta function with 2 parameters (optimal and maximum temperatures) and
> the time function is a 2-parameter Weibull. Adjustments with nls or gnls
> work, but I need to do mixed-effects modeling.
> 
> It seems like nlme or nlmer need self starting functions, but so far I
> can't find a way to code a selfstart function with 2 "x" covariates. Is it
> just impossible? Is there another way?
> 
> Thanks
> 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Custom-nonlinear-self-starting-function-w-2-covariates-tp2286099p2287391.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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