问题描述
关于自相关,如果时间序列必须作为因子提供给glmmTMB
,那么ar1()
如何判断时间步长相距多远?
在 glmmTMB
中,ar1
要求时间步长均匀分布并编码为一个因子(请参阅此 vignette)。给定一个数字时间序列 time.steps
,将其重新编码为 as.factor(time.steps)
是否足以让模型正确运行?如果必须提供时间序列作为一个因素,glmmTMB
如何判断时间间隔有多远?
解决方法
将其重新编码为 as.factor(time.steps) 是否足以让模型正确运行?
是的。
如果必须提供时间序列作为一个因素,glmmTMB 如何判断时间间隔有多远?
假设因子的连续水平相隔一个时间步长(coord_set
> array([[26,21],[18,17],[50,6],...,[14,47],[15,12],[ 7,8]])
dists
> array([2.23606798,5.65685425,1.41421356,3.16227766,3.,1.41421356])
协方差结构不允许不均匀间隔的时间步长:为此,您需要 import psycopg2
import folium
import psycopg2
conn = psycopg2.connect(database = "databasename",user = "postgres",password = "password",host = "localhost",port = "5432" )
print("Base de dados conectado com sucesso")
cur = conn.cursor()
cur = conn.cursor()
cur.execute('select * from "CADASTRO_USUARIO"')
rows=cur.fetchall()
for index,row in cur:
rows = (f" {r[6]} {r[7]}")
center = [-8.894870,13.296380]
map_angola = folium.Map(location=center,zoom_start=10)
#LINE PRESENTING THE ERROR
folium.Marker([r['{r[6]} {r[7]}']],popup=['Location'],icon=folium.Icon(icon='cloud')).add_to(map_angola)
map_angola.save('Profissionais.html')
协方差结构,其中您需要使用 ar1()
对时间值进行编码)。
更多细节:AR1结构随机效应的相关结构是
ou()
其中行/列位置对应于因子的时间步长/水平。因此,除了时间步长的阶次之外,我们真的不需要知道任何其他信息,它由因子水平的阶次指定。