Learn R Programming

smooth (version 2.4.1)

graphmaker: Linear graph construction function

Description

The function makes a standard linear graph using at least actuals and forecasts.

Usage

graphmaker(actuals, forecast, fitted = NULL, lower = NULL, upper = NULL,
  level = NULL, legend = TRUE, main = NULL, cumulative = FALSE)

Arguments

actuals

The vector of actual series.

forecast

The vector of forecasts. Should be ts object that start at the end of fitted values.

fitted

The vector of fitted values.

lower

The vector of lower bound values of a prediction interval. Should be ts object that start at the end of fitted values.

upper

The vector of upper bound values of a prediction interval. Should be ts object that start at the end of fitted values.

level

The width of the prediction interval.

legend

If TRUE, the legend is drawn.

main

The title of the produced plot.

cumulative

If TRUE, then the forecast is treated as cumulative and value per period is plotted.

Value

Function does not return anything.

Details

Function uses the provided data to construct a linear graph. It is strongly advised to use ts function to define the start of each of the vectors. Otherwise the data may be plotted in a wrong way.

See Also

ts

Examples

Run this code
# NOT RUN {
x <- rnorm(100,0,1)
values <- es(x,model="ANN",silent=TRUE,intervals=TRUE,level=0.95)

graphmaker(x,values$forecast,values$fitted)
graphmaker(x,values$forecast,values$fitted,legend=FALSE)
graphmaker(x,values$forecast,values$fitted,values$lower,values$upper,level=0.95)
graphmaker(x,values$forecast,values$fitted,values$lower,values$upper,level=0.95,legend=FALSE)

actuals <- c(1:10)
forecast <- ts(c(11:15),start=end(actuals)[1]+end(actuals)[2]*deltat(actuals),
               frequency=frequency(actuals))
graphmaker(actuals,forecast)

# }

Run the code above in your browser using DataLab