如何在嵌套的logit glmer模型(使用lme4)中获取每个系数的p值? [英] How to obtain the p-values for each coefficient in a nested logit glmer model (using lme4)?

查看:185
本文介绍了如何在嵌套的logit glmer模型(使用lme4)中获取每个系数的p值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行以下代码:

library(lme4)
library(nlme)
nest.reg2 <- glmer(SS ~  (bd|cond), family = "binomial", 
    data = combined2)
coef(nest.reg2)
summary(nest.reg2) 

哪个会产生以下输出:

  • 系数
$cond    
          bd (Intercept)
LL -1.014698    1.286768   
no -3.053920    4.486349
SS -5.300883    8.011879

  • 摘要
  • Generalized linear mixed model fit by maximum likelihood (Laplace
      Approximation) [glmerMod]
     Family: binomial  ( logit )
    Formula: SS ~ (bd | cond)
       Data: combined2
    
         AIC      BIC   logLik deviance df.resid 
      1419.7   1439.7   -705.8   1411.7     1084 
    
    Scaled residuals: 
        Min      1Q  Median      3Q     Max 
    -8.0524 -0.8679 -0.4508  1.0735  2.2756 
    
    Random effects:
     Groups Name        Variance Std.Dev. Corr 
     cond   (Intercept) 33.34    5.774         
            bd          13.54    3.680    -1.00
    Number of obs: 1088, groups:  cond, 3
    
    Fixed effects:
                Estimate Std. Error z value Pr(>|z|)  
    (Intercept)  -0.3053     0.1312  -2.327     0.02 *
    

    我的问题是如何测试此模型中每个系数的显着性?摘要函数似乎仅提供截距的p值,而不提供系数.

    My question is how do I test the significance of each of the coefficients for this model? The Summary function seems to only provide a p-value for the intercept, not the coefficients.

    当我尝试 anova(nest.reg2)时,我什么也没得到,只是:

    When I try anova(nest.reg2) I get nothing, just:

    Analysis of Variance Table
         Df Sum Sq Mean Sq F value
    

    我尝试了这里提出的解决方案(如何在lme4混合模型中获得效果的p值(检查显着性)?)无济于事.

    I've tried the solutions proposed here (How to obtain the p-value (check significance) of an effect in a lme4 mixed model?) to no avail.

    为澄清起见, cond 变量是一个具有三个级别的因子( SS no LL ),并且我相信 coef 命令会在每个级别上为连续的 bd 变量生成系数,因此我要尝试的是测试那些变量的意义系数.

    To clarify, the cond variable is a factor with three levels (SS, no, and LL), and I believe that the coef command produces coefficients for the continuous bd variable at each of those levels, so what I'm trying to do is test the significance of those coefficients.

    推荐答案

    这里有几个问题.

    • 主要的一点是,您实际上只能对固定效应系数进行显着性检验;您已经对模型进行了编码,没有固定的效果.您可能正在寻找
    • the main one is that you can really only do significance testing on fixed effect coefficients; you have coded your model with no fixed effects. You might be looking for
    glmer(SS ~ bd + (1|cond), ...)
    

    将对 bd 级别之间的总体(人群级别)差异进行建模,并包括在 cond 级别之间的截距变化.

    which will model the overall (population-level) distinctions among the levels of bd and include variation in the intercept among levels of cond.

    • 如果每个 cond 组中具有多个级别的 bd ,那么您可以原则上允许不同治疗方法之间的差异 cond 组:
    • If you have multiple levels of bd represented in each cond group, then you can in principle also allow for variation in treatment effects among cond groups:
    glmer(SS ~ bd + (bd|cond), ...)
    

    • 但是,您还有另一个问题.实际上,三个组(即 cond 的级别)不足以估计组之间的变异性.这就是为什么您在输出中看到-1.00的相关性的原因,这表明您具有奇异的拟合度(例如,请参见此处以进行更多讨论).
    • 因此,
    • 还有另一种可能性,就是继续将 cond 视为固定效果(调整 cond 上的对比度,以便使 bd的主要效果是各个组的平均值,而不是基线(cond)的基线水平的影响.)
      • however, you have another problem. Three groups (i.e., levels of cond) isn't really enough, in practice, to estimate variability among groups. That's why you're seeing a correlation of -1.00 in your output, which indicates you have a singular fit (e.g. see here for more discussion).
      • therefore, another possibility would be to just go ahead and treat cond as a fixed effect (adjusting the contrasts on cond so that the main effect of bd is estimated as the average across groups rather than the effect in the baseline level of cond).
      • glm(SS~bd*cond,contrasts=list(cond=contr.sum),...)
        

        这篇关于如何在嵌套的logit glmer模型(使用lme4)中获取每个系数的p值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆