【发布时间】:2018-11-07 04:45:51
【问题描述】:
我正在使用 mgcv 包中的 gamm 模型来分析具体的多样性如何衡量,例如。香农随时间和环境变量而变化,例如。温度。
到目前为止,我已经有了分析时间序列的初始模型:
modf<-gamm(y~ as.factor(year) + s(doy,bs='cc',k=kdy),method=mth,correlation=tcor,data=d,
control=ctrl,random=NULL,gamma=1)
我想将温度作为随机效应包含在内,并考虑执行以下操作:
modf<-gamm(y~ as.factor(year) + s(doy,bs='cc',k=kdy), + s(temp,bs="re"),method=mth,
correlation=tcor,data=d,control=ctrl,gamma=1)
但是,到目前为止,我只看到 gam 而不是 gamm。这种方式还能用吗?
数据结构类型示例:
- $ total_abundance: num 6364161 1929775 7057036 1266342 3981198 ...
- $ shannon : 数字 1.87 2.08 1.95 1.84 2.06 ...
- $ 营业额 : num 0.613 0.475 0.525 0.556 0.429 ...
- $ 年 : int 1985 1986 1987 1987 1987 1988 1989 1989 1991
- $ 月 : int 8 12 3 7 8 5 1 8 1 9 ...
- $ 天:int 20 8 15 6 17 9 16 29 14 4 ...
- $ temp : num 25.5 9.87 4.8 19.72 26.03 ...
- $ doy : num 232 342 74 187 229 130 16 241 14 247 ...
其中 doy 是“一年中的某一天”并考虑了季节性
谢谢
【问题讨论】:
-
您能否详细说明“添加温度作为随机效应”是什么意思?
temp是连续变量还是其他?你心目中的分组结构是什么?我是否可以建议在您的问题中包含一些示例数据 - 这样您更有可能获得有用的答案。
标签: r mixed-models gam mgcv