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

如何从glmmTMB的Conway-Maxwell Poisson模型提取Lambda与Nu参数

提取glmmTMB中Compois模型的λ和ν参数

glmmTMB包的compois家族对Conway-Maxwell Poisson(COM-Poisson)模型的参数化方式,和COMPoissonReg包中rcmp函数的参数定义存在差异,需通过转换获取对应的λ和ν参数:

1. 获取ν参数

glmmTMB将COM-Poisson模型的分散参数设为φ = 1/ν,因此:

  • predict(Mod, type = "disp")返回的是φ值
  • 实际ν参数为ν = 1/φ

若模型未指定分散协变量,所有观测的φ值一致,也可直接从模型结果提取:

# 提取对数尺度的分散参数并转换为φ
phi <- exp(Mod$fit$par["betad"])
nu <- 1/phi

2. 获取λ参数

COM-Poisson模型的均值μ(即predict(Mod, type = "response")的结果)和λ、ν的关系为:
μ = λ^(1/ν) * Γ(2/ν) / Γ(1/ν)
其中Γ()为伽马函数。反推可得λ的计算公式:
λ = (μ * Γ(1/ν) / Γ(2/ν))^ν

完整代码示例:

# 提取均值μ
mu <- predict(Mod, type = "response")
# 提取分散参数φ并计算ν
phi <- predict(Mod, type = "disp")
nu <- 1/phi
# 计算λ参数
lambda <- (mu * gamma(1/nu) / gamma(2/nu))^nu

验证说明

你模拟数据时使用了lambda=3、nu=2,转换后得到的λ和ν应接近这些真值(因模拟数据存在随机噪声,会有小幅偏差)。

内容的提问来源于stack exchange,提问作者Kevin Tongam Anggatama

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 08:43:38