glmmTMB 中的时间自回归:为什么需要时间作为一个因素? [英] Temporal autoregression in glmmTMB: why does it require time as a factor?

查看:74
本文介绍了glmmTMB 中的时间自回归:为什么需要时间作为一个因素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于自相关,如果必须将时间序列作为因子提供给 ar1()glmmTMB 如何判断时间步长相距多远?

With regards to autocorrelation, how can glmmTMB tell how far apart time steps are if the time sequence must be provided to ar1() as a factor?

glmmTMB 中,ar1 要求时间步长均匀分布并编码为一个因子(请参阅此 vignette).给定一个数字时间序列 time.steps,将其重新编码为 as.factor(time.steps) 是否足以让模型正确运行?如果必须提供时间序列作为一个因素,glmmTMB 如何判断时间间隔有多远?

In glmmTMB, ar1 requires timesteps to be evenly spaced and to be coded as a factor (see this vignette). Given a numerical time series time.steps, is it enough to recode it as as.factor(time.steps) for the model to run correctly? How can glmmTMB tell how far apart moments in time are if the time sequence must be provided as a factor?

推荐答案

将其重新编码为 as.factor(time.steps) 是否足以让模型正确运行?

is it enough to recode it as as.factor(time.steps) for the model to run correctly?

是的.

如果必须提供时间序列作为一个因素,glmmTMB 如何判断时间间隔有多远?

How can glmmTMB tell how far apart moments in time are if the time sequence must be provided as a factor?

假设因素的连续水平相隔一个时间步长(ar1() 协方差结构不允许不均匀间隔的时间步长:为此,您需要 ou() 协方差结构,需要使用 numFactor() 对时间值进行编码.

The assumption is that successive levels of the factor are one time step apart (the ar1() covariance structure does not allow for unevenly spaced time steps: for that you need the ou() covariance structure, for which you need to use numFactor() to encode the time values).

更多细节:AR1结构随机效应的相关结构是

For a little more detail: the correlation structure for an AR1-structured random effect is

1     rho   rho^2  rho^3 ...
rho   1     rho    rho^2 ...
rho^2 rho   1      rho   ...
rho^3 rho^2 rho    1     ...
...   ...   ...    ...   ...

其中行/列位置对应于因子的时间步长/水平.因此,除了时间步长的阶次之外,我们真的不需要知道任何其他信息,它由因子水平的阶次指定.

where the row/column positions correspond to time steps/levels of the factor. So we really don't need to know anything more than the order of the time steps, which is specified by the order of the levels of the factor.

这篇关于glmmTMB 中的时间自回归:为什么需要时间作为一个因素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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