R中的自启动功能

时间:2013-09-25 19:06:28

标签: r regression self

我试图将蚊子发育方面的非线性回归与我从论文中得到的温度进行拟合,但作者没有建立一个函数。此外,为了设置非线性回归,我使用了breier等人(1999)所述的第一个模型:

开发速度(1 /天)= a * Tpred *(Tpred-TO)* sqrt(TL-Tpred)TO

其中a是常数 Tpred是用作发展速度预测因子的温度 TO是开发为零时的温度 TL是致命温度

数据是:

温度:15,20,25,30,35

rate_to_adult:0.028571430,0.06944444,0.09615385,0.11363636,0.03130081。

和我的代码遵循Ritz书中的非线性回归与R

model_function<-function(Tpred,a,TO,Tl){a*Tpred*(Tpred-TO)*sqrt(Tl-Tpred)}
#function   for the model

model_initial<-function(mCall,LHS,data){
xy<-sortedXyData(mCall[['Tpred']],LHS,data)
fit<-lm(xy[,'y']~xy[,'x'])
coefs<-coef(fit)
a<-coefs[1]    
TO<-coefs[2]
Tl<-coefs[3]
value<-c(a,TO,Tl)

names(value)<-mCall[c('a','TO','Tl')]
value
}

Self_starter<-selfStart(model_function,model_initial,c('a','TO','Tl'))

print(getInitial(rate_to_adult ~ Self_starter(Temp,a,TO,Tl), param), digits = 3)

上一行生成:

0.00300 0.00299 NA

分别为a,TO和Tl

和     m1&lt; -nls(rate_gon~Self_starter(Temp,a,TO,Tl),data = param)

生成:numericDeriv中的错误(表单[[3L]],名称(ind),env): 在评估mod

时产生的缺失值或无穷大

我需要修改什么来实际获取起始值(所有这些)和模型适合?

由于

0 个答案:

没有答案