[R] predict

David Winsemius dwinsemius at comcast.net
Wed Jul 29 17:09:58 CEST 2009


You need to create the variable names in newdata (which is generally a  
dataframe)  that match those used in constructing fm. Surely there  
must be a worked example that illustrates this on the help page?

On Jul 29, 2009, at 9:30 AM, serbring wrote:

>
> I have found a regression model, and i would like to predict value in
> different points. I have tried to use predict function but it  
> doesn't work.
> I have used predict function like this:
>
> newdata<-seq(from=0.1, to=0.32,by=0.02)
> data<-predict(fm,newdata)
>
> where fm is a regression model. The predict function return me that:
>
> Error in eval(predvars, data, env) :   numeric argument 'envir'  
> doesn't have
> unitary length
>
> where is the error?

Hard to tell what other errors at work might be at work since no  
reproducible example (and not even the original code to construct fm)  
was offered. Please re-read the Posting Guide.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list