最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to bootstrap ANOVA type 3 fixed effects of a linear mixed model in R (lme4)? - Stack Overflow

programmeradmin9浏览0评论

I've been trying to bootstrap a linear mixed model with three 2-level categorical fixed factors (and all two-way interactions), and one random factor.

I can get the linear mixed model to run, I can bootstrap the linear mixed model, and I can get the type 3 fixed effects of the linear mixed model. The problem is combining those last two. I'm looking to get bootstrapped type 3 fixed effects of the linear mixed model, and I can't figure out how to get those.

The linear mixed model seems to provide the estimates of fixed effects (which compare fixed effects to a reference category), but not the type 3 fixed effects. To get those, I run an ANOVA on the linear mixed model. I understand how to bootstrap the linear mixed model itself (or a regular ANOVA), but I'm struggling with how to run an bootstrap on an the ANOVA of the linear mixed model, which is what I need to get bootstrapped type 3 fixed effects of the linear mixed model.

I'm using the libraries lme4, lmerTest, and lmeresampler.

Here is the relevant part of my code:

#Run the linear mixed model:
lmm=lmer(unlist(DV) ~ unlist(IV1) + unlist(IV2) + unlist(IV3) + unlist(IV1):unlist(IV2) + unlist(IV1):unlist(IV3) + unlist(IV2):unlist(IV3) + (1 | unlist(randomfactor)), data = table)

#Bootstrap the linear mixed model:
lmm.boot=bootstrap(lmm, type = "residual", B = 5000, resample = c(TRUE, TRUE))

#Get type 3 fixed effects of the linear mixed model:
anova.lmm=anova(lmm)

The output running the ANOVA on the linear mixed model looks like this:

Type III Analysis of Variance Table with Satterthwaite's method
                                          Sum Sq Mean Sq NumDF   DenDF F value Pr(>F)
unlist(sex)                                44.03   44.03     1 109.041  0.1831 0.6696
unlist(f0groupfemale)                     611.01  611.01     1  16.435  2.5406 0.1300
unlist(f0groupmale)                        10.37   10.37     1  16.431  0.0431 0.8381
unlist(sex):unlist(f0groupfemale)         149.70  149.70     1 108.462  0.6225 0.4319
unlist(sex):unlist(f0groupmale)            89.36   89.36     1 109.708  0.3716 0.5434
unlist(f0groupfemale):unlist(f0groupmale)  66.19   66.19     1  16.419  0.2752 0.6069

Question: Is there a way to bootstrap the type 3 ANOVA here? I know ANOVA.boot can be used to bootstrap a regular ANOVA, but I can't get it to work with the ANOVA of the linear mixed model.

发布评论

评论列表(0)

  1. 暂无评论