[论文解读] hmmTMB: hidden Markov models with flexible covariate effects in R
本论文介绍了 R 包 hmmTMB,该包支持使用惩罚样条(penalized splines)对非线性效应进行建模,并引入随机效应以处理个体间异质性,从而实现灵活的隐马尔可夫模型(HMMs),并允许协变量影响转移参数和观测参数。其主要贡献是一个计算高效、模块化的复杂 HMM 框架,支持自动平滑度选择,并可处理多变量、连续、离散和二值响应。
Hidden Markov models (HMMs) are widely applied in studies where a discrete-valued process of interest is observed indirectly. They have for example been used to model behaviour from human and animal tracking data, disease status from medical data, and financial market volatility from stock prices. The model has two main sets of parameters: transition probabilities, which drive the latent state process, and observation parameters, which characterise the state-dependent distributions of observed variables. One particularly useful extension of HMMs is the inclusion of covariates on those parameters, to investigate the drivers of state transitions or to implement Markov-switching regression models. We present the new R package hmmTMB for HMM analyses, with flexible covariate models in both the hidden state and observation parameters. In particular, non-linear effects are implemented using penalised splines, including multiple univariate and multivariate splines, with automatic smoothness selection. The package allows for various random effect formulations (including random intercepts and slopes), to capture between-group heterogeneity. hmmTMB can be applied to multivariate observations, and it accommodates various types of response data, including continuous (bounded or not), discrete, and binary variables. Parameter constraints can be used to implement non-standard dependence structures, such as semi-Markov, higher-order Markov, and autoregressive models. Here, we summarise the relevant statistical methodology, we describe the structure of the package, and we present an example analysis of animal tracking data to showcase the workflow of the package.
研究动机与目标
- 为解决隐马尔可夫模型(HMMs)中协变量效应建模的灵活性需求,特别是非线性关系和个体间异质性。
- 通过允许协变量影响转移概率和观测分布参数,扩展标准 HMMs。
- 提供一个计算高效且模块化的 R 包,支持复杂模型结构,包括混合效应和半-Markov 结构。
- 在基于似然的推断框架内,利用惩罚样条实现非线性效应的自动平滑度选择。
- 通过参数约束支持多种响应类型(连续、二值、离散)和复杂依赖结构。
提出的方法
- 使用带固定效应和随机效应的混合线性预测模型来参数化转移和观测参数:$\eta = \mathbf{X}\bm{\alpha} + \mathbf{R}\bm{\beta}$,$\bm{\beta} \sim N(\mathbf{0}, \mathbf{Q})$。
- 通过拉普拉斯近似实现自动平滑度选择,利用惩罚样条(P-splines)对非线性协变量效应进行建模,包括单变量和多变量样条。
- 利用 TMB(Template Model Builder)框架,通过拉普拉斯近似快速计算边际似然。
- 支持多种响应分布(正态分布、二项分布、泊松分布等),并通过参数约束建模非-Markov 过程(如高阶 Markov、半-Markov)。
- 提供模型拟合、推断和可视化工具,包括绘制转移概率、状态概率和带置信区间的随机效应的函数。
- 使用前向算法进行似然评估,并通过数值优化估计模型参数。
实验结果
研究问题
- RQ1如何将 HMM 扩展以建模协变量对转移和观测参数的非线性效应?
- RQ2在纵向数据中,个体间异质性对状态转移动态有何影响?
- RQ3能否有效将具有自动平滑度选择的惩罚样条集成到 HMM 中,以实现灵活的非线性建模?
- RQ4如何在统一的 HMM 框架内实现复杂依赖结构(如半-Markov、高阶 Markov)?
- RQ5在包含随机效应和样条的复杂 HMM 中,拉普拉斯近似的性能和可靠性如何?
主要发现
- 该包成功建模了海燕在距离中心位置超过 1000 公里后,从“迁徙”状态向“觅食”状态转移的概率,显示该概率急剧下降。
- 对转移 S3→S2 的个体特异性随机截距估计的标准差为 0.414,表明个体间状态转移行为存在显著差异。
- 模型表明,处于“迁徙”状态的概率随距中心位置距离的增加而显著降低,提示存在目标性觅食行为。
- 对距离影响转移概率的平滑效应估计结果附带 95% 置信带,证明了惩罚样条在灵活、数据驱动建模中的实用性。
- 对转移 S2→S3 的随机效应标准差估计值为:截距项 0.466,样条项 0.123,表明该转移存在强烈的个体水平变异。
- 该包能够高效实现对复杂 HMM 的推断,包括多变量响应和参数约束,计算性能足以应对现实世界中的生态学和生物医学数据。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。