我有兴趣对几年内的温度数据时间序列进行建模。数据是每小时观察的水平,所以我有年、月、日和时间的变量。
我发现了 Gavin Simpson 的一个很好的例子(在这里找到)。该博客仅考虑一年内的相关性,而我必须处理一年内和一天内的相关性。
我怎样才能最好地解释与 gamm 的这种相关性?加文使用以下代码
modar2 <- gamm(apparentTemperature ~ s(month, bs = "cc", k = 12) + s(time, k = 20),data = timetemp, correlation = corARMA(form = ~ 1|year, p = 2),control = ctrl)
我应该在哪里传递变量来解释一天内的相关性?
作为参考,这是我的数据示例:
tibble::tribble(
~created_at, ~time, ~month, ~year,
~apparentTemperature,
"2014-01-03 09:30:28", 9.5, 1, 2014, -17.87,
"2014-01-03 10:13:43", 10.2166666666667, 1, 2014, -17.87,
"2014-01-03 12:19:32", 12.3166666666667, 1, 2014, -16.14,
"2014-01-03 12:44:04", 12.7333333333333, 1, 2014, -20.24,
"2014-01-03 13:09:38", 13.15, 1, 2014, -20.24,
"2014-01-03 13:39:00", 13.65, 1, 2014, -20.44
)