[R] glm predict issue
bravegag at gmail.com
Mon Dec 26 17:03:15 CET 2011
Yes thanks you are right, I was able to fix it but first I had to fix the data frame over which I built my model to use numeric for those and then making the grid values also numeric it finally worked thanks!
Thank you for your help!
On Dec 26, 2011, at 4:57 PM, Ben Bolker wrote:
> 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 =
> object$xlevels) :
>> 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))
> for example.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help