You could just say:
yhat=predict(reg1,x2)
the function predict will assing x2 to 'newdata' by default.
thanks
Daniel Malter wrote:
>
> Hi,
>
> could it be the "newdata" argument? When I run predict with the newdata
> argument, I get an error message - a different one though. The second
> reason
> might be that your dataset is named df, which is defined as a function an
> may produce problems. Try renaming the dataset.
>
> yhat=predict(reg1,newdata=x2)
>
> x1=seq(1:100)
> r.norm1=rnorm(100,0,20)
> x1=r.norm1+x1
>
> x2=x1*2
> r.norm2=rnorm(200,0,20)
> x2=r.norm2+x2
>
> reg1=glm(y1~x1,binomial)
> yhat=predict(reg1) ##prediction works fine
> yhat=predict(reg1,newdata=x2) ##gives error message because of "newdata"
>
>>Error in eval(predvars, data, env) :
-- View this message in context: http://www.nabble.com/predict.glm---newdata-tp16501614p16986751.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.Received on Wed 30 Apr 2008 - 17:31:13 GMT
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.
Archive generated by hypermail 2.2.0, at Mon 05 May 2008 - 16:30:33 GMT.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.