在r中移动绘图线

发布于 2025-01-20 22:17:25 字数 520 浏览 0 评论 0原文

我正在尝试将预测和实际验证值的图叠加。 我得到以下情节

我想移动红色图,以与浅蓝色图重叠。

try1 = ts(validation_noSnoT, frequency = 7)
ses <- ets(ts(train_noSnoT, frequency = 7), model = "ANA")
ses.pred <- predict(ses, h = length(try1),level = 0)
ses.pred
plot(ses.pred)
lines(ses.pred$fitted, lwd = 2, col = "blue")
lines(try1,lwd = 2, col = "red")

有人可以帮忙吗?

I am trying to superimpose the plots of the predictions and the actual validation values.
I am getting the following plot
enter image description here

I want to move the red plot to overlap with the light blue plot.

try1 = ts(validation_noSnoT, frequency = 7)
ses <- ets(ts(train_noSnoT, frequency = 7), model = "ANA")
ses.pred <- predict(ses, h = length(try1),level = 0)
ses.pred
plot(ses.pred)
lines(ses.pred$fitted, lwd = 2, col = "blue")
lines(try1,lwd = 2, col = "red")

can someone help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葬﹪忆之殇 2025-01-27 22:17:25

所以我做了以下事情并且它起作用了:

x_range =  seq(19057.14,by=1/7,length.out=length(noSnoT))
plot(predictions,main="Test")
lines(predictions$fitted, lwd = 2, col = "blue")
lines(x_range[(limit+1):length(value)],validation_value, col ="red")

我所做的就是在训练数据结束的地方开始行。所以我必须手动检查这个值并将其插入到 seq() 函数中。由于我的频率是每周 by 设置为 1/7。 limit 只是 floor(train_per * length(noSnoT)),其中 train_per 是整个数据集的训练数据百分比
输入图片此处描述

So i did the following and it worked:

x_range =  seq(19057.14,by=1/7,length.out=length(noSnoT))
plot(predictions,main="Test")
lines(predictions$fitted, lwd = 2, col = "blue")
lines(x_range[(limit+1):length(value)],validation_value, col ="red")

What i did was to start the lines at where my training data ended. So I had to check this value manually and insert it in the seq() function. As my frequency was weekly by was set to 1/7. limit is just floor(train_per * length(noSnoT)) where train_per is the training data percentage of the entire dataset
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文