mkshaw / r2mlm

r2mlm: R Package for Calculating R-Squared in Multilevel Models
27 stars 1 forks source link

Handling missing data #23

Closed mkshaw closed 3 years ago

mkshaw commented 4 years ago

From an email:

"fortify.merMod does not address the missing data (see here a similar issue: https://github.com/lme4/lme4/issues/390). In that issue, an alternative approach to pull the data while addressing the missing data is proposed: data <-broom::augment(model)"

Try using broom::augment(model), see if results are as expected.

mkshaw commented 4 years ago

broom::augment() is fine for r2mlm, but for r2mlm_comp it doesn't pull all variables like fortify.merMod() does, which creates the issue that models A and B have to be hierarchical.

mkshaw commented 4 years ago

For now, if a user pre-treats their data with data <- na.omit(data) and then runs their model in lme4 or nlme, that gets around the missing data issue.