[英]R - linear regression model of seasonal time series
我正在使用每月平均值。 我有 24 年的数据。 (所以 12 * 24 = 288 行)。 我正在尝试使用 function tslm(即代码)创建线性回归 model。
library(tidyverse)
library("tseries")
library(forecast)
data <- read_csv("data.csv")
data$START_TIME <- as.Date(data$START_TIME)
data_TS <- ts(data$VALUE, frequency = 12)
fit <- tslm(data_TS ~ trend + season)
summary(fit)
目前output是:
Residuals:
Min 1Q Median 3Q Max
-19.9684 -4.6493 -0.0578 3.9262 23.3977
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 70.803362 1.628675 43.473 < 2e-16 ***
trend -0.009475 0.005170 -1.833 0.06794 .
season2 11.006465 2.066983 5.325 2.13e-07 ***
season3 11.540922 2.067002 5.583 5.76e-08 ***
season4 13.159978 2.067034 6.367 8.31e-10 ***
season5 12.753431 2.067080 6.170 2.50e-09 ***
season6 11.666369 2.067138 5.644 4.22e-08 ***
season7 -6.322834 2.067209 -3.059 0.00245 **
season8 -24.284647 2.067293 -11.747 < 2e-16 ***
season9 -34.434003 2.067390 -16.656 < 2e-16 ***
season10 -35.778105 2.114752 -16.918 < 2e-16 ***
season11 -27.213367 2.089425 -13.024 < 2e-16 ***
season12 -14.267532 2.140674 -6.665 1.49e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 7.16 on 269 degrees of freedom
(4 observations deleted due to missingness)
Multiple R-squared: 0.8778, Adjusted R-squared: 0.8723
F-statistic: 161 on 12 and 269 DF, p-value: < 2.2e-16
我想从 output 创建方程,但我缺少第 1 季的系数。
谁能解释我如何解释摘要中的值以及如何创建我的数据的线性 model 方程?
谢谢
合身有一个截距。 因此,截距向您显示了season1
时的值。 否则,拦截将毫无意义。 如果你想要它明确,你可以让你的 model 显示
fit <- tslm(data_TS ~ 0 + trend + season)
[根据后续问题编辑更多信息]
考虑这一点的一种方法是尝试手动想象使用 model 来获取data_TS
的估计值 - 你可以看到,如果你有一个截距和所有 12 个季节,你将能够在没有季节时得到一个值因素是真实的。 该值将是截距。
tslm output 就像其他 lm 输出一样。 web 上有很多关于它们的学习指南。 大多数人假设您从统计文本中了解线性回归 model 正在做什么。 您可能想要搜索“在 R 中解释线性 model 结果”。 这是一个结果,其中包含来自 Felipe Rego的每个 output 项目的一些细节
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.