Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avg_comparisons and nlme::lme() models #244

Closed
mprimbs opened this issue Feb 19, 2024 · 1 comment
Closed

Avg_comparisons and nlme::lme() models #244

mprimbs opened this issue Feb 19, 2024 · 1 comment

Comments

@mprimbs
Copy link

mprimbs commented Feb 19, 2024

Dear Team,

I'm estimated a mixed-effects model with nlme::lme() and want to use marginaleffects::avg_predictions() on the lme object.

After running the code:

ModelWeek1 <- nlme::lme(IAT_Score ~ BeginProtests_f + age_centred + genderIdentity_f,
random = (~ 1 | STATE),
data = df_propensity_wts,
na.action = "na.omit",
control = lmerControl(optimizer = "bobyqa", calc.derivs = FALSE),
weights = ~1/wts)

avg_predictions(ModelWeek1,
variables = "BeginProtests_f",
wts = "wts",
vcov = "HC3")

I get the following warning message:

Warning message:
Unable to extract a variance-covariance matrix using this vcov argument. Standard errors are computed using the default variance
instead. Perhaps the model or argument is not supported by the sandwich or clubSandwich packages. If you believe that the
model is supported by one of these two packages, you can open a feature request on Github.

I looked at the sandwich help pages and it seems that lme objects are supported (https://rdrr.io/cran/clubSandwich/man/vcovCR.lme.html).

Hence, I`m contacting you here to see whether I'm doing something wrong and/or how to use avg_predictions() successfully with robust standard errors.

Best Regards,

Max

@larmarange
Copy link
Owner

Hi. It seems that the problem you encountered was with marginaleffects::avg_predictions(). Therefore, you should post your issue on the marginaleffects repository: https://github.com/vincentarelbundock/marginaleffects

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants