title: Error: variables were specified with different types from the fit
body: <p>In <code>car</code>package, I am trying to predict the response variable called <code>prestige</code> in a dataset also named <code>Prestige</code> based on <code>income</code>, <code>education</code>, and factor <code>type</code> by <code>lm</code> function. But before I fit data, I want to scale <code>education</code> and <code>income</code>. The code below if you copy and run it in R stuido, the console would say <code>Error: variables ‘income’, ‘I(income^2)’, ‘education’, ‘I(education^2)’ were specified with different types from the fit</code></p>
  
  <pre><code>library(car)
  summary(Prestige)
  Prestige$education &lt;- scale(Prestige$education)
  
  Prestige$income &lt;- scale(Prestige$income)
  
  fit &lt;- lm(prestige ~ income + I(income^2) + education + I(education^2)
            + income:education + type + type:income + type:I(income^2) 
            + type:education + type:I(education^2)+ type:income:education, Prestige)
  summary(fit)
  pred &lt;- expand.grid(income = c(1000, 20000), education = c(10,20),type = levels(Prestige $ type))
  pred $ prestige.pred &lt;- predict(fit, newdata = pred)
  pred
  </code></pre>
  
  <p>Without scaling the predictors, it can successfully work. So the error is definitely due to the scaling before prediction and I am wondering how to fix this issue? </p>