[R] glm predict issue
bbolker at gmail.com
Mon Dec 26 16:57:03 CET 2011
Giovanni Azua <bravegag <at> gmail.com> writes:
> I have tried reading the documentation and googling for the answer but
reviewing the online matches I end up
> more confused than before.
> My problem is apparently simple. I fit a glm model (2^k experiment), and then
I would like to predict the
> response variable (Throughput) for unseen factor levels.
> When I try to predict I get the following error:
> > throughput.pred <- predict(throughput.fit,experiments,type="response")
> Error in model.frame.default(Terms, newdata, na.action = na.action, xlev =
> factor 'No_databases' has new level(s) 200, 400, 600, 800, 1000
> Of course these are new factor levels, it is exactly what I am trying to
achieve i.e. extrapolate the values
> of Throughput.
> Can anyone please advice? Below I include all details.
Any predictors that you want to treat as continuous
(which would be the only way you can extrapolate to unobserved
values) should be numeric, not factor variables -- use
mydata <- transform(mydata, var=as.numeric(var))
More information about the R-help