Learn R Programming

smooth (version 2.5.5)

plot.smooth: Plots for the fit and states

Description

The function produces plot actuals, fitted values and forecasts and states of the model

Usage

# S3 method for smooth
plot(x, which = c(1, 2, 4, 6), level = 0.95,
  legend = FALSE, ask = prod(par("mfcol")) < length(which) &&
  dev.interactive(), lowess = TRUE, ...)

Arguments

x

Time series model for which forecasts are required.

which

Which of the plots to produce. The possible options (see details for explanations):

  1. Fitted over time;

  2. Standardised residuals vs Fitted;

  3. Studentised residuals vs Fitted;

  4. Absolute residuals vs Fitted;

  5. Squared residuals vs Fitted;

  6. Q-Q plot with the specified distribution;

  7. ACF of the residuals;

  8. PACF of the residuals;

  9. Plot of states of the model.

level

Confidence level. Defines width of confidence interval. Used in plots (2), (6) and (7).

legend

If TRUE, then the legend is produced on plots (1), (2) and (3).

ask

Logical; if TRUE, the user is asked to press Enter before each plot.

lowess

Logical; if TRUE, LOWESS lines are drawn on scatterplots, see lowess.

...

The parameters passed to the plot functions. Recommended to use with separate plots.

Value

The function produces the number of plots, specified in the parameter which.

Details

The list of produced plots includes:

  1. Fitted over time. Plots actuals (black line), fitted values (purple line), point forecast (blue line) and prediction interval (grey lines). Can be used in order to make sure that the model did not miss any important events over time;

  2. Standardised residuals vs Fitted. Plots the points and the confidence bounds (red lines) for the specified confidence level. Useful for the analysis of outliers;

  3. Studentised residuals vs Fitted. This is similar to the previous plot, but with the residuals divided by the scales with the leave-one-out approach. Should be more sensitive to outliers;

  4. Absolute residuals vs Fitted. Useful for the analysis of heteroscedasticity;

  5. Squared residuals vs Fitted - similar to (3), but with squared values;

  6. Q-Q plot with the specified distribution. Can be used in order to see if the residuals follow the assumed distribution. The type of distribution depends on the one used in the estimation (see distribution parameter in alm);

  7. ACF of the residuals. Are the residuals autocorrelated? See acf for details;

  8. PACF of the residuals. No, really, are they autocorrelated? See pacf for details;

  9. Plot of the states of the model. It is not recommended to produce this plot together with the others, because there might be several states, which would cause the creation of a different canvas. In case of "msdecompose", this will produce the decomposition of the series into states on a different canvas.

Which of the plots to produce, is specified via the which parameter.

See Also

plot.greybox

Examples

Run this code
# NOT RUN {
ourModel <- es(c(rnorm(50,100,10),rnorm(50,120,10)), "ANN", h=10)
par(mfcol=c(3,3))
plot(ourModel, c(1:9))

# }

Run the code above in your browser using DataLab