title: Nonlinear model with nls(): Error: Parameters without initial values
body: <p>I would like to estimate a nonlinear regression model of the following kind:</p>
  
  <pre><code>y=ß0 + ß1*( b[1,theta]*x1 +  b[2,theta]*x2 )+ e
  </code></pre>
  
  <p>Description of the elements:</p>
  
  <pre><code> 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)
  </code></pre>
  
  <p>And finally, b[i,theta] for i=1,2 represents the following Exponential Almon Polynomial Weighting Function:</p>
  
  <pre><code>b[i,theta]= exp(theta1*i+theta2*k^2)/(exp(theta1*1+theta2*1^2) + exp(theta1*2+theta2*2^2))
  </code></pre>
  
  <p>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. </p>
  
  <p>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().</p>
  
  <p>I tried the following which resulted in an error message:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Note: for notational simplicity I calculated the denominator value of the weighting     function beforehand, which amounts to 1318837781. </p>
  
  <p>It seems that <code>nls()</code> 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 <code>nls()</code>?</p>
  
  <p>Thanks!</p>