title: R predicting from multivariate polynomial models
body: <p>I have 3 columns of data in a dataframe (data) with no headers.</p>
  
  <p>The 1st and 2nd column are the independent variables and the 3rd column is the dependent variable.</p>
  
  <p>I have to fit a polynomial of order 3 in the independent variables.</p>
  
  <p>I did:</p>
  
  <pre><code>dm &lt;- data.matrix(data[,1:2])
  pmodel &lt;- lm(data.matrix(data[,3])~poly(dm,degree = 3,raw=TRUE))
  </code></pre>
  
  <p>Now how can i predict the answer for a given pair of the independent variables say (0.77,0.36) ?</p>
  
  <p>I tried:</p>
  
  <pre><code>predict.lm(pmodel,data.frame(0.77,0.36))
  </code></pre>
  
  <p>But this gives some error saying:</p>
  
  <p>'newdata' had 1 row but variables found have 100 rows</p>