我在为某事苦苦挣扎。如果我用 lm 估计指数函数并使用变换,即。
leastsquares.complete=lm(log(PPPrate)~Highest+Mortrate5Y+Crate+DummieJan+DummieDec,weights=Notional)
b.completebestin= predict.lm(leastsquares.completebestout)
Forecast.completebestin= exp(b.completebestin)
我得到的结果与使用加权 nls 不同
form<-as.formula(PPPrate~exp(alfa0+alfa1*Highest+alfa2*Mortrate5Y+alfa3*Crate+alfa4*DummieJan+alfa5*DummieDec))
nlsresultshehe=nls(
form,
data=AllDataXX,
start=list(alfa0=1,alfa1=1,alfa2=1,alfa3=1,alfa4=1,alfa5=1),trace=TRUE,
weight=Notional,control=nls.control(minFactor=0.0001,maxiter = 5000))
T=summary(nlsresultshehe)$parameters
Forecast=exp(T[1,1]+Highest*T[2,1]+Mortrate5Y*T[3,1]+Crate*T[4,1]+DummieJan*T[5,1]+DummieDec*T[6,1])
它与加权方案有关吗?我有点迷失在这里