从 glmmadmb 输出中提取过度离散参数

问题描述 投票:0回答:1

我想知道是否有人知道如何从 R 中

glmmadmb
的输出中提取色散参数的估计值。我正在使用负二项式模型,并且希望将此代码用于几个不同的物种,而无需必须进入并手动提取该值以用于代码的其余部分。

这是我的输出示例:

  > summary(mod1)

       Call:
           glmmadmb(formula = species ~ (1 | year) + (1 | site), data = cs, 
           family = "nbinom2", link = "log")

        AIC: 8131.7 

       Coefficients:
        Estimate Std. Error z value Pr(>|z|)    
        (Intercept)     4.05       0.19    21.3   <2e-16 ***
          ---
         Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

       Number of observations: total=798, year=53, site=15 
       Random effect variance(s):
       Group=year
                  Variance StdDev
       (Intercept)   0.1925 0.4388
       Group=site
                  Variance StdDev
       (Intercept)   0.4748  0.689

       Negative binomial dispersion parameter: 1.7211 (std. err.: 0.088936)

       Log-likelihood: -4061.86 

我还没有找到提取该值的函数。

r parameters
1个回答
2
投票

glmmadmb
的帮助页面除其他外还显示:

价值:

 An object of class ‘"glmmadmb"’ representing the model fit,
 including (among others) components:

   b: vector of fixed effects

   S: covariance matrix of random effects

alpha:尺度/过度分散参数(负二项式,Gamma, 测试版)

所以我认为

mod1$alpha
(或者
mod1[["alpha"]]
,如果你想非常小心的话)应该得到你想要的。

如果文档不存在,您可以(1)按照@DWin的建议查看

glmmADMB:::print.summary.glmmadmb
的代码; (2) 查看
names(mod1)
str(mod1)
,找到与您想要的部分相对应的模型对象部分。

可能应该有一个访问器方法,但我不知道 R 中是否有一致的约定来提取模型的色散类型参数......

© www.soinside.com 2019 - 2024. All rights reserved.