在 R 情节 arima 拟合模型与原始系列 [英] In R plot arima fitted model with the original series

查看:32
本文介绍了在 R 情节 arima 拟合模型与原始系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 GRETL.在那里,当我对 arima 模型的验证进行预测时,我将得到蓝线中的拟合序列和红线中的原始序列.后来,我切换到 R,在这里我找不到任何命令来做同样的事情.我正在使用预测包中的 Arima 模型.

I was using GRETL. There, when I do the forecasting for the validation of the arima model, I will get the fitted series in blue line and the original series in red line. Later, I switched to R and here I could not find any command to do the same. I am using Arima model from forecast package.

详情,

在 GRETL 中,我用来做模型-> 时间序列-> arima -> 预测.它将自动打印适合的和原始的系列.任何想法在 R 上做同样的事情?

In GRETL I use to do model->time series -> arima -> forecast. It will automatically print the fitted and the original series. Any idea to do the same on R?

推荐答案

这个问题相当开放,但这里有一个非常非常基本的答案.直接从 forecast 包中 Arima 的帮助文件中提供的示例之一开始:

This question is fairly open ended, but here is a very, very basic answer. Starting directly from one of the examples provided in the help files for Arima in the forecast package:

fit <- Arima(WWWusage,order=c(3,1,0))

你说你想要红色的原始系列和蓝色的拟合系列:

You say you want the original series in red and the fitted series in blue:

plot(fit$x,col="red")
lines(fitted(fit),col="blue")

产生一个看起来像这样的图:

which produces a plot that looks something like this:

对于这样的基本问题,我建议您花一些时间这里 熟悉 R 的一些基本功能.

For basic questions like this, I suggest you spend some quality time here becoming familiar with some of R's basic functionality.

这篇关于在 R 情节 arima 拟合模型与原始系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆