R plot arima fitted model with the original series

0 votes
I was initially using GRETL. But, when I tried doing the forecasting for the validation of ARIMA model, I got the fitted series in blue line and the original series in red line.

When I switched to R, I could not find any commands to do the same. I am using the ARIMA model from the forecast package.

Can someone help me with implementing it in R?
May 18, 2018 in Data Analytics by Sahiti
• 6,290 points
2,001 views

1 answer to this question.

0 votes

This question has many ways to answer, but here is a very, very basic answer. 

This is one of the examples provided in the help files for ARIMA in the forecast package:

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

Suppose you want the original series in red and the fitted series in blue:

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

You can try out this commands and check the output!

answered May 18, 2018 by DataKing99
• 8,150 points

Related Questions In Data Analytics

0 votes
1 answer

Save a plot as image on the disk using R

Consider for both the situations: 1. Image will ...READ MORE

answered Apr 13, 2018 in Data Analytics by Sahiti
• 6,290 points
389 views
0 votes
1 answer

How to plot side-by-side Plots with ggplot2 in R?

By Using gridExtra library we can easily ...READ MORE

answered Apr 16, 2018 in Data Analytics by DeepCoder786
• 1,720 points
3,290 views
0 votes
1 answer

Changing the order of bars in a bar-plot - ggplot2 - R

You can use the scale_x_discrete() function with ...READ MORE

answered May 28, 2018 in Data Analytics by Bharani
• 4,560 points
5,932 views
0 votes
1 answer

How to write a custom function which will replace all the missing values in a vector with the mean of values in R?

Consider this vector: a<-c(1,2,3,NA,4,5,NA,NA) Write the function to impute ...READ MORE

answered Jul 4, 2018 in Data Analytics by CodingByHeart77
• 3,710 points
605 views
0 votes
1 answer

How to forecast season and trend of data using STL and ARIMA in R?

You can use the forecast.stl function for the ...READ MORE

answered May 18, 2018 in Data Analytics by DataKing99
• 8,150 points
827 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
504 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
311 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points
131 views
0 votes
1 answer

What are the options for deploying models in production with R?

Well, I could say that the answer ...READ MORE

answered Apr 12, 2018 in Data Analytics by DataKing99
• 8,150 points
474 views
0 votes
1 answer

How to find out the sum/mean for multiple variables per group in R?

You can use the reshape2 package for ...READ MORE

answered Apr 12, 2018 in Data Analytics by DataKing99
• 8,150 points
987 views