[R-sig-ME] Using Robust Standard Errors lme4

Daniel Lüdecke d@|uedecke @end|ng |rom uke@de
Tue Nov 9 22:19:30 CET 2021


Hi Suresh,
I just tried to find an example with glmer(), but it indeed looks like the
clubSandwich package only supports lmer() models, not glmer(). So my
suggested approach unfortunately doesn't seem to work.

Best
Daniel

Am Di., 9. Nov. 2021 um 17:24 Uhr schrieb Suresh N Neupane <
sneupane2 using student.gsu.edu>:

> Hi Daniel,
> Thank you so much for your suggestions. I tried that but it gives me an
> error:
>
> Error in UseMethod("estfun") :
>   no applicable method for 'estfun' applied to an object of class
> "c('glmerMod', 'merMod')"
>
> My DV is death (0/1) and IV other variables:
> Model: (with random county effects):
> fit <- glmer(death ~ (1|county_fips_code) +white + black + pop.density ,
> family = binomial("logit"), nAGQ=0, data = data.thesis)
>  I tried the code you sent and used "county_fips_code" as my cluster
> variable but it says did not find "county_fips_code".
> I was able to use parameters::model_parameters(fit) to extract some info
> (This is great!) such as;
>  Parameter     |  Log-Odds |   SE |  95% CI |   z |     p
>
> Thank you so much again,
> I'd really appreciate if you would have more input on this.
> Sincerely,
> Suresh
>
>
>
>
> ------------------------------
> *From:* Daniel Lüdecke <d.luedecke using uke.de>
> *Sent:* Tuesday, November 9, 2021 4:32 AM
> *To:* Suresh N Neupane <sneupane2 using student.gsu.edu>
> *Cc:* r-sig-mixed-models using r-project.org <r-sig-mixed-models using r-project.org>
> *Subject:* AW: [R-sig-ME] Using Robust Standard Errors lme4
>
> Hi Suresh,
>
> you could try the "parameters" package, which should (easily) return
> different types of robust standard errors, including cluster-robust
> standard
> errors for mixed models:
>
>
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Feasystats.github.io%2Fparameters%2Farticles%2Fmodel_parameters_robust.html&data=04%7C01%7Csneupane2%40student.gsu.edu%7Ca99f7d4a171f419a724a08d9a363ee14%7C704d822c358a47849a1649e20b75f941%7C0%7C0%7C637720471875578865%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DOoXhh%2FzuFnNc6ZTAb9hry9%2FSB7QD%2F7bEYX%2BaHLQBhE%3D&reserved=0
>
> Maybe you try this out on a very small subset of your model to see if it
> works. Also, since the "model_parameters()" function includes random
> effects
> variances by default, you may set the effects-argument to "fixed" to speed
> up computation. The call to the function could then look like something
> like
> this:
>
> model_parameters(
>   model,
>   effects = "fixed",
>   robust = TRUE,
>   vcov_estimation = "CL",
>   vcov_type = "HC1",
>   vcov_args = list(cluster = <your cluster variable from the data>)
> )
>
>
> Best
> Daniel
>
> -----Ursprüngliche Nachricht-----
> Von: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> Im
> Auftrag von Suresh N Neupane via R-sig-mixed-models
> Gesendet: Montag, 8. November 2021 12:49
> An: r-sig-mixed-models using r-project.org
> Betreff: [R-sig-ME] Using Robust Standard Errors lme4
>
> Dear all,
> I am using lme4 package to run a hierarchical logistic regression model
> (with random county effect) for my binomial dependent variable, COVID death
> (0/1). This is a very large dataset with ~ 8 million observations.
> I need to find the robust standard error but was not sure about any
> package.
> I tried robustlmm (although my DV is not continuous) and got this error
> when
> used MerDeriv (sandwich):
> Error in UseMethod("estfun") :
> no applicable method for 'estfun' applied to an object of class
> "c('glmerMod', 'merMod')"
> The real tricky part is it takes several hours to compute because of the
> dataset length.
> All I need is to get robust standard error values.
> I already fit the models:
> fit <- glmer(death ~ (1|county_fips_code) + IV).
> Thank you so much,
> Suresh Neupane
>
>
--

_____________________________________________________________________

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg | www.uke.de
Vorstandsmitglieder: Prof. Dr. Burkhard Göke (Vorsitzender), Joachim Prölß, Prof. Dr. Blanche Schwappach-Pignataro, Marya Verdel
_____________________________________________________________________

SAVE PAPER - THINK BEFORE PRINTING

	[[alternative HTML version deleted]]



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