pred.compareModels {predtoolsTS} | R Documentation |
Compare different predictions
Description
Plots the original time serie along with 2-5 predictive models.
Usage
pred.compareModels(originalTS, p_1, p_2, p_3 = NULL, p_4 = NULL,
p_5 = NULL, legendNames = NULL, colors = NULL, legend = TRUE,
legendPosition = NULL, yAxis = "Values", title = "Predictions")
Arguments
originalTS |
A |
p_1 |
A |
p_2 |
A |
p_3 |
A |
p_4 |
A |
p_5 |
A |
legendNames |
String vector with the names for the legend. Has to be same length as number of time series we are plotting(including the original one). Default is NULL. |
colors |
Vector with the colors. Has to be same length as number of time series we are plotting(including the original one). Default is NULL. |
legend |
A logical. Do we want a legend? Default is TRUE. |
legendPosition |
A string with the position of the legend (bottomright, topright, ...). Default is NULL. |
yAxis |
A string. Name for the y axis. "Values" as default. |
title |
A string. Title for the plot. Default is "Predictions". |
Details
This function aims to ease the comparation between different predictive models by plotting them into the same graphic.
Author(s)
Alberto Vico Moreno
Examples
data(AirPassengers)
#pre-processing
p <- prep(AirPassengers)
#modelling
arima.modl <- modl(p)
cart.modl <- modl(p,method='dataMining',algorithm='rpart')
#predicting
arima.pred <- pred(arima.modl,n.ahead=30)
cart.pred <- pred(cart.modl,n.ahead=45)
#post-processing
arima.pred <- postp(arima.pred,p)
cart.pred <- postp(cart.pred,p)
#visual comparison
pred.compareModels(AirPassengers,arima.pred$predictions,cart.pred$predictions
,legendNames=c('AirPassengers','ARIMA','CART'),yAxis='Passengers',legendPosition = 'topleft')