[R] How to set up a Negative Exponential regression mixed effect model 'nlme' ?

Ronny Steen kestrel1978 at gmail.com
Thu Nov 17 23:13:48 CET 2016


I need help with fitting a non-linear mixed effects model (nested random
effect). I look at the relationship between 'wingbeat frequency' (beats per
sec) and 'wing length' in hummingbirds, and I will find a model with the
best fit.

I have posted the question at R-SIG-mixed-models list, but no answer so
far, therefore I give it a new try here.

I manage to fit Negative Natural Exponential regression and Assymptotic
(SSasymp-function) nonlinear regression, but I don't figure out how to fit
Negative Exponential regression (similar to nls {stats} function

*My question:* Could I get some help adapting the Negative Exponential
regression model (*'nls'*, without random effect) to a model with nested
random effect (*'nlme' *)?

Script and access to data:



WBF <-read.csv(url("https://www.dropbox.com/s/hin8o27i1kmdloe/

plot(WBF$WL,WBF$Beat_freq,type="p",ylab="WBF")# Make a plot

#Negative Natural Exponential regression with nested random effect

fm1<-lme(Beat_freq ~ exp(-WL),

data = WBF,

random = ~ 1|Species/ID, method = "ML")

#Assymptotic (SSasymp-function) nonlinear regression with nested random

fm2 <- nlme(Beat_freq ~ SSasymp(WL, Asym, R0, lrc),

        data = WBF,

        fixed = Asym + R0 + lrc ~ 1,

        random = Asym ~ 1|Species/ID,

        start = c(Asym = 27, R0 = 6000, lrc = 0.19))

#Negative Exponential regression - HELP NEEDED TO INCLUDE NESTED RANDOM
EFFECT ('nlme')

negexp<-selfStart(model = ~b0 + b1*exp(-x/th), initial =




     data=WBF,control=list(maxiter =5000),trace=T)



	[[alternative HTML version deleted]]

More information about the R-help mailing list