/*
** Plot differenced data and forecast
*/
// Declare 'myPlot' to be a plotControl structure
// and fill with default values
struct plotControl myPlot;
myPlot = plotGetDefaults("xy");
// Turn grid off
plotSetGrid(&myPlot, "off");
// Font settings
font_name = "Helvetica Neue";
font_color = "black";
plotSetTitle(&myPlot, "Differenced data and VAR(2) model forecast",
font_name, 18, font_color);
// Add a tick label every 10 years, starting at 1860
plotSetXTicInterval(&myPlot, 10, 1860);
// Legend
plotSetLegend(&myPlot, "Y1 Obs." $| "Y2 Obs.");
plotSetLegendFont(&myPlot, font_name, 14, font_color);
// Plot differenced 'y' data
plotTS(myPlot, 1850, 1, y);
// Set line style to dots for forecasted data
plotSetLineStyle(&myPlot, 3);
// Legend
plotSetLegend(&myPlot, "Y1 Forecasts"$|"Y2 Forecasts");
plotSetLegendFont(&myPlot, font_name, 14, font_color);
// Add forecasts to plot
plotAddTS(myPlot, 1910, 1, f[.,2:3]);
Have a Specific Question?
Get a real answer from a real person
Need Support?
Get help from our friendly experts.