forecast.cov {dse2}R Documentation

Forecast covariance for different models

Description

Calculate the forecast covariance for different models.

Usage

    is.forecast.cov(obj)
    forecast.cov(obj, ...)
    forecast.cov(obj, ..., data=NULL, discard.before=NULL,
       horizons=1:12, zero=F, trend=F, estimation.sample= periods(data),
       compiled=.DSECOMPILED)
    forecast.cov(obj, data=NULL, ..., discard.before=NULL,
       horizons=1:12, zero=F, trend=F, estimation.sample= NULL,
       compiled=.DSECOMPILED)
    forecast.cov(obj, data=NULL, horizons=1:12, discard.before=1,
   compiled=.DSECOMPILED)

Arguments

obj TSdata or one or more TSmodels or TSestModels
data An object of class TSdata.
discard.before Period before which forecasts should be discarded when calculating covariance.
horizons Horizons for which forecast covariance should be calculated.
zero If T the covariance is calculated for a forecast of zero.
trend If T the covariance is calculated for a forecast of trend.
estimation.sample Portion of the sample to use for calculating the trend.

Details

Calculate the forecast cov of obj relative to data. If obj is TSdata then the output data is used as the forecast. For other classes of obj TSmodel(obj) is used with data to produce a forecast. TSmodel() is also applied to each element of ... to extract a model. All models should work with data. If obj is a TSestModel and data is NULL then TSdata(obj) is used as the data. This is just multiple applications of forecast.cov.single.TSmodel discard.before is an integer indicating the number of points in the beginning of forecasts to discard before calculating covariances. If it is the default, NULL, then the default (minimum.startup.lag) will be used for each model and the default (1) will be used for trend and zero. If zero is T then forecast.cov is also calculated for a forecast of zero. If trend is T then forecast.cov is also calculated for a forecast of a linear trend using data to estimation.sample.

Value

A list with the forecast covariance for supplied models on the given sample. This is in the element forecast.cov of the result. Other elements contain information in the arguments.

Examples

    if(is.R()) data("eg1.DSE.data.diff", package="dse1")
    model1 <- est.VARX.ar(eg1.DSE.data.diff)
    model2 <- est.VARX.ls(eg1.DSE.data.diff)
    z <-  forecast.cov(model1, model2, data=trim.na(eg1.DSE.data.diff))
    is.forecast.cov(z)