[R] How to use predict() so that one retains the rows that they're associated with?

Richard M. Heiberger rmh at temple.edu
Thu Oct 20 15:05:26 CEST 2016


I believe you have missing values and therefore you need to use
the argument
glm(formula, data, na.action=na.exclude, ...)

?na.exclude

The relevant line is

     when 'na.exclude' is used the residuals and
     predictions are padded to the correct length by inserting 'NA's
     for cases omitted by 'na.exclude'.

Rich

On Thu, Oct 20, 2016 at 7:40 AM, mviljamaa <mviljamaa at kapsi.fi> wrote:
> I'm using predict() for my glm() logistic model, but I'm having trouble
> relating the predicted results to the rows that produced them.
>
> I want to be able to plot predictions along some categorical variables.
>
> So what can I do in order to get predicted values but also know what
> variable values produced them?
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list