As a R
beginner, I am trying to fix a model given including a random factor. The formula is:
Temp ~ a - (b * exp(-c *rate))
Where Temp
is temperature and rate
is a measure of the variation (time/temp). For construct the model and get the initial parameters I use the nlme
package:
data1<-groupedData((Temp~rate|Year), data=data)
fm1<-nlme(Temp ~ a - (b * exp(-c *rate)), data=data, fixed=Temp~rate, start=c(a=8.10,b=7.24,c=0.5))
Error in eval(expr, envir, enclos) : object 'a' not found`
I have tried this as well:
`fm100<-selfStart(~a-(b*exp(-c*rate)),
function(mCall, data, LHS)
{
xy<-sortedXyData(mCall[["x"]], LHS, data)
tmp<-coef(lm(Temp~rate, data=data),
value<-c(exp(tmp[1],temp[2])
getInitial=c("a","b","c"))
}`
Error: unexpected symbol in:
"value<-c(exp(tmp[1],temp[2]) getInitial"
Perhaps is a simple question but I haven’t found anything useful yet.
Here are the data:
Temp<-c(9,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,14,14,17.1,17.6,17.6,19.6,20.6,21.3,21.3,22.8,22.8,22.8,22.8,22.8,22.8,22.8,22.8,22.8,22.8,22.8,23.5,23.8,11.4,11.4,11.4,11.4,11.7,11.7,12.6,13.6,13.6,14.6,14.6,14.6,14.6,15.7,15.7,15.7,16.1,16.1,16.7,16.7,11.6,12.6,12.6,12.6,14.5,14.5,14.7,15.8,15.8,15.8,15.8,16,16,16,16,16,16,16,16,16,16)
Rate<-c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,0.0417,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
Year<-c(2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2006,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2010,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011,2011)
data<-data.frame(Temp, Rate, Year)
Thank you in advance!