R 中回归输出中排除的虚拟变量系数(无错误)(时间序列图未更改)
刚开始在这里发帖,但对这些宝贵的资源还不是很熟悉。环顾四周,没有看到任何对我的情况有帮助的东西。 运行拟合的 LogLinear 回归模型(成功),当我尝试使用“虚拟”变量进行调整时,我没有收到任何错误。我也没有收到趋势调整回归模型中虚拟变量系数的输出。
感谢您抽出时间。
数据=图书馆(fpp3)的纪念品
代码如下:
library(fpp3)
# Data
tsdat <- souvenirs
# Model
fit_tsdat_dummy <- tsdat %>%
mutate(DummyDec = month(Month) == 12) %>%
model(TSLM(log(Sales) ~ trend() + season()))
report(fit_tsdat_dummy) # Coefficients expected here
# Produces the same plot as non-adjusted time-series plot
# Validates no coefficients above, but why?)
augment(fit_tsdat_dummy) %>%
ggplot(aes(x = Month)) +
geom_line(aes(y = Sales, colour = "Data")) +
geom_line(aes(y = .fitted, colour = "Fitted")) +
labs(x = "Month",
y = "Sales",
title = "Monthly Sales")
New to posting here, but not to the invaluable resources. Looked around and did not see anything that helped in my situation.
Running a fitted LogLinear regression model (successful) and when I attempted to adjust using "dummy" variables, I received no error. I also did not receive outputs for the dummyvars coefficients in my trend adjusted regression model.
Thank you for your time.
Data = souvenirs of library(fpp3)
code looks like :
library(fpp3)
# Data
tsdat <- souvenirs
# Model
fit_tsdat_dummy <- tsdat %>%
mutate(DummyDec = month(Month) == 12) %>%
model(TSLM(log(Sales) ~ trend() + season()))
report(fit_tsdat_dummy) # Coefficients expected here
# Produces the same plot as non-adjusted time-series plot
# Validates no coefficients above, but why?)
augment(fit_tsdat_dummy) %>%
ggplot(aes(x = Month)) +
geom_line(aes(y = Sales, colour = "Data")) +
geom_line(aes(y = .fitted, colour = "Fitted")) +
labs(x = "Month",
y = "Sales",
title = "Monthly Sales")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两个问题:
1.没有在模型公式中调用虚拟变量。
2. 存在共线性,因此相应的“重复”虚拟变量为 NaN。
谢谢。
NTS:附加列 - 标志检查属性。
TWO ISSUES:
1. Did not call the Dummy variable in the model formula.
2. Collinearity was present, therefore NaN for the respective "duplicate" dummy.
Thank you.
NTS: Additional columns - flag check attribute.