Re: [R] Fit values for NA's in linear regression

From: Liaw, Andy <>
Date: Sat 18 Jun 2005 - 03:02:26 EST

I posted a bad example. The question would only make sense if NAs are all in the response. Here's try #2:

I believe you can not get fitted values for cases where y is missing directly from the model object. You can, however, use predict(lm.object, newdata=mydata[!complete.cases(mydata)]) to get the predictions for those with missing y.


> From: Luca Wacker
> Hi,
> To obtain estimates for some missing values in my data I fitted a
> linear regression and then used the command fitted(model) to get the
> fitted values from the model, but R doesn't return any values for the
> NA's. I can calculate the fitted values from the estimates obtained
> from the summary of model, but that's not very handy. Is
> there a way to
> include the missing values in the analysis and get fitted values for
> the NA's? I tried to use with the function na.action, but that didn't
> work.
> thanks
> Luca
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!
> mailing list PLEASE do read the posting guide! Received on Sat Jun 18 04:19:55 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:48 EST