r2mlm
r2mlm copied to clipboard
Can't subset columns that don't exist.
Can't subset columns that don't exist.
x Column na.exclude
doesn't exist.
Hi @smasters11, can you provide me with some more information about your model and data? What's the structure of your dataset (run str(data)
) and what model(s) you ran?
I used hierarchical linear modeling (HLM) with the “nlme” package with maximum likelihood estimation. I do have some missing data points, so my code included “na.action=na.exclude” in my code. I don't know how to tell R that na.exlclude is not a column
Can you post your model definition here? For example, this is the model from the r2mlm documentation:
model_lme4 <- lmer(satisfaction ~ 1 + salary_c + control_c + salary_m + control_m + s_t_ratio + (1 + salary_c + control_c| schoolID), data = teachsat, REML = TRUE)
energy3 <- lme(fixed = ZQ4.3 ~ ZQ4.2Gender + ZQ4.5Gender+ ZEnergyAgenticGender + ZEnergyComGender, data = data2, random = ~ 1 | School, na.action=na.exclude, method="ML")
Great, thanks for bringing this to my attention! I'll look into it.
@smasters11 I think I've fixed this particular issue. Can you try installing the development version of the package by running devtools::install_github("mkshaw/r2mlm", ref = "refactoring")
, then library(r2mlm)
, and then run your model again and see what you get?
I really appreciate how hard you have been working on this! I got a different error this time. Error in r2mlm_nlme(model) : Your data must be numeric. Only the cluster variable can be a factor
Okay, cool, this error I'm more familiar with! See here: https://github.com/mkshaw/r2mlm/issues/22 Are your predictors (ZQ4.2Gender + ZQ4.5Gender+ ZEnergyAgenticGender + ZEnergyComGender) all numeric (not text-based)? And as you can see at the github issue linked above, it seems like some people are having issues where even their clustering variable (in your case, School) must be numeric. Let me know how that goes.
All of my data looks like this:
energy3 <- lme(fixed = ZQ4.3 ~ ZQ4.2_Gender + ZQ4.5_Gender+ ZEnergyAgentic_Gender + ZEnergyCom_Gender, data = data2, random = ~ 1 | School, na.action=na.exclude, method="ML")
@smasters11 What's going on here with the variables ZQ4.2_Gender
and ZEnergyAgentic_Gender
-- are those interaction variables normally in your function as ZQ4.2*Gender
that just dropped the asterisk when you copied them over to regular text?
@smasters11 Can you also share what operating system and version of R you're using? I just tried to replicate this error and couldn't.