I would like to estimate a nonlinear regression model of the following kind:
y=ß0 + ß1*( b[1,theta]*x1 + b[2,theta]*x2 )+ e
Description of the elements:
y: the regressand
x1: regressor 1
x2: regressor 2
ß0: parameter to be estimated
ß1: parameter to be estimated
e: iid random noise ~ N(mu, sigma)
And finally, b[i,theta] for i=1,2 represents the following Exponential Almon Polynomial Weighting Function:
b[i,theta]= exp(theta1*i+theta2*k^2)/(exp(theta1*1+theta2*1^2) + exp(theta1*2+theta2*2^2))
It just represents two decaying weights for x1 and x2, nothing more. But these weights depend on two parameter values, which are also to be estimated: theta1 and theta2.
Now, I would like to estimate the optimal (with respect to RSS criterion) values for the parameters ß0, ß1, theta1 and theta2 using the nonlinear least squares function nls().
I tried the following which resulted in an error message:
nls(y~beta0+beta1*(exp(theta1*1+theta2*1^2)/1318837781*x1+exp(theta1*2+theta2*2^2)/1318837781*x2),data=d,start=list(beta0=1,beta1=1,theta1=.01,theta2=-.0099))
Error in nls(y ~ beta0 + beta1 * (exp(theta1 * 1 + theta2 * 1^2)/1318837781 * :
Parameters without initial values in 'data': x1, x2
Note: for notational simplicity I calculated the denominator value of the weighting function beforehand, which amounts to 1318837781.
It seems that nls()
sees x2 and x2 as parameters, but they are regressors. What am I doing wrong here and how should I modify the code to get reasonable results. Or is it impossible to estimate such kind of function with nls()
?
Thanks!