[R-sig-ME] na.action = na.augment for random effects in lme4?

Phillip Alday ph||||p@@|d@y @end|ng |rom mp|@n|
Mon Oct 12 00:05:34 CEST 2020


Doesn't look like it, the documentation for predict.merMod has option:


> allow.new.levels: logical if new levels (or NA values) in ‘newdata’ are
>           allowed. If FALSE (default), such new values in ‘newdata’
>           will trigger an error; if TRUE, then the prediction will use
>           the unconditional (population-level) values for data with
>           previously unobserved levels (or NAs).

Maybe packages adding some extra functionality like merTools have some
things for this.


Otherwise, you can just filter your newdata with something like

newdata[newdata$groupingvar %in% levels(olddata$groupingvar), ]

Phillip


On 11/10/2020 23:42, Andrew Robinson wrote:
> Hi all,
>
> I'm interested in fitting and applying models for which the data to which I apply the model will have some observations with random effects levels that are not in the fitting dataset.  I would like to flag these observations in some way.
>
> Naively, I would prefer to have something like the na.action = na.augment argument so that predictions for observations with previously unseen levels of random effects would simply be missing.  Is there such a capability that I've missed?
>
> Warm wishes,
>
> Andrew
>
>
> --
> Andrew Robinson
> Director, CEBRA and Professor of Biosecurity,
> School/s of BioSciences and Mathematics & Statistics
> University of Melbourne, VIC 3010 Australia
> Tel: (+61) 0403 138 955
> Email: apro using unimelb.edu.au
> Website: https://researchers.ms.unimelb.edu.au/~apro@unimelb/
>
> I acknowledge the Traditional Owners of the land I inhabit, and pay my respects to their Elders.
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list