You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用glmmTMB拟合beta_family模型后残差图出现模式的问题

比例数据建模:解决过/欠离散后残差存在模式的问题

问题背景

我正在处理比例数据,尝试多种模型解决过离散和欠离散问题:

  • 初始使用二项分布模型时出现过离散
  • 引入OLRE(过离散随机效应)后转为欠离散
  • 改用beta_family()拟合模型后,过离散与欠离散问题得到解决,但残差图显示存在明显模式

所有变量已完成标准化。

模型代码

bdd$prop <- (bdd$tot_paras) / bdd$puesta

y <- cbind(bdd$tot_paras, bdd$nac) 

bdd$prop <- pmax(pmin(bdd$prop, 1 - 1e-5), 1e-5)
y <- pmax(pmin(bdd$prop, 1 - 1e-5), 1e-5)


mpt5 <- glmmTMB(y ~ altsca * coastsca * infestsca * NAO_t1sca + 
                  (1|site) + (altsca|year) + (1|id), 
                family = beta_family(), 
                data = bdd)

模型汇总结果

summary(mpt5)
 Family: beta  ( logit )
Formula:          y ~ altsca * coastsca * infestsca * NAO_t1sca + (1 | sitio) +  
    (altsca | year) + (1 | id)
Data: bdd

     AIC      BIC   logLik deviance df.resid 
 -3046.9  -2910.8   1545.5  -3090.9     3581 

Random effects:

Conditional model:
 Groups Name        Variance Std.Dev. Corr 
 sitio  (Intercept) 0.32707  0.5719        
 year   (Intercept) 0.04375  0.2092        
        altsca      0.02278  0.1509   0.84 
 id     (Intercept) 0.65928  0.8120        
Number of obs: 3603, groups:  sitio, 35; year, 12; id, 3603

Dispersion parameter for beta family (): 7.25 

Conditional model:
                                    Estimate Std. Error z value Pr(>|z|)    
(Intercept)                         -0.85460    0.14358  -5.952 2.65e-09 ***
altsca                              -0.59531    0.13203  -4.509 6.52e-06 ***
coastsca                            -0.09911    0.12997  -0.763 0.445730    
infestsca                            0.15908    0.03603   4.415 1.01e-05 ***
NAO_t1sca                           -0.08945    0.06985  -1.281 0.200322    
altsca:coastsca                     -0.39947    0.17170  -2.327 0.019987 *  
altsca:infestsca                     0.01210    0.04966   0.244 0.807511    
coastsca:infestsca                  -0.10618    0.06121  -1.735 0.082811 .  
altsca:NAO_t1sca                     0.08227    0.05643   1.458 0.144869    
coastsca:NAO_t1sca                  -0.09151    0.03187  -2.871 0.004088 ** 
infestsca:NAO_t1sca                  0.08243    0.02259   3.649 0.000263 ***
altsca:coastsca:infestsca           -0.11711    0.07914  -1.480 0.138915    
altsca:coastsca:NAO_t1sca           -0.08114    0.04026  -2.015 0.043858 *  
altsca:infestsca:NAO_t1sca          -0.01356    0.02488  -0.545 0.585860    
coastsca:infestsca:NAO_t1sca        -0.02923    0.03031  -0.964 0.334825    
altsca:coastsca:infestsca:NAO_t1sca -0.07461    0.03592  -2.077 0.037795 *  

过离散检查结果

performance::check_overdispersion(mpt5)
# Overdispersion test

 dispersion ratio = 0.887
          p-value =  0.12

未检测到过离散。

残差与预测值情况

  • 残差图:存在明显模式
  • 观测值与预测值对比图:展示观测值和模型预测值的对应关系

内容的提问来源于stack exchange,提问作者KSN2

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 11:14:55