Using Time series forecasting , I tried to predict the sales of a particular item.I have got the required predicted plot . I want to extract the exact value from the plot. i.e I have the values from 2011-2016.Using time series forecasting I predicted the values for 2016-2020, but it's in the form of a plot.How to extract the predicted values from the plot?
Asked
Active
Viewed 435 times
-1
-
1Welcome to Stack Overflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – zx8754 Jul 04 '16 at 11:35
1 Answers
0
Say you have prediction<-predict(model,...)
then the values should be accessible through
prediction$values
or post a screen of str(your_object)
and it will be clear from there.

Zheyuan Li
- 71,365
- 17
- 180
- 248

Jan Sila
- 1,554
- 3
- 17
- 36
-
Thanks for you response. > acf(diff(log(sales))) > pacf(diff(log(sales))) > fit <- arima(log(sales),c(0, 1, 1),seasonal = list(order = c(0, 1, 1), period = 12)) > pred <- predict(fit,n.ahead = 10*12) > ts.plot(sales,2.718^pred$pred,log = "y", lty = c(1,3)) > pred$values NULL This is the code I used. After pred$values , I am getting the output as NULL. – parth gera Jul 04 '16 at 17:22
-
Was it helpful? Could you please mark my answer as accepted then, please? Thanks – Jan Sila Jul 04 '16 at 17:23
-
Then what you're looking or is in pred$pred. It will pop out: ` > p$pred Time Series: Start = 101 End = 110 Frequency = 1 [1] -0.7636109 -0.7636109 -0.7636109 -0.7636109 -0.7636109 -0.7636109 -0.7636109 -0.7636109 [9] -0.7636109 -0.7636109 > as.vector(p$pred) [1] -0.7636109 -0.7636109 -0.7636109 -0.7636109 -0.7636109 -0.7636109 -0.7636109 -0.7636109 [9] -0.7636109 -0.7636109' ` – Jan Sila Jul 04 '16 at 21:09
-
-