Documentation Center

  • Trial Software
  • Product Updates

infer

Class: garch

Infer GARCH model conditional variances

Syntax

V = infer(model,Y)
[V,LogL] = infer(model,Y)
[V,LogL] = infer(model,Y,Name,Value)

Description

V = infer(model,Y) infers the conditional variances of a univariate GARCH model fit to data Y.

[V,LogL] = infer(model,Y) additionally returns the loglikelihood objective function values.

[V,LogL] = infer(model,Y,Name,Value) infers the GARCH model conditional variances with additional options specified by one or more Name,Value pair arguments.

Input Arguments

model

garch model object, as created by garch or estimate. The input model object cannot have any NaN values.

Y

numObs-by-numPaths matrix of response data whose conditional variances are inferred. Y usually represents an innovation series with mean zero and variances characterized by the GARCH model specified in model. In this case, Y is a continuation of the innovation series E0. Y might also represent a time series of innovations with mean zero plus an offset. The inclusion of an offset is signaled by a nonzero Offset property in model.

If Y is a column vector, it represents a single path of the underlying series. If Y is a matrix, it represents numObs observations of numPaths paths of an underlying time series. infer assumes that observations across any row occur simultaneously. The last observation of any series is the most recent.

    Note:   NaNs indicate missing values. The toolbox uses listwise deletion to remove these values from Y, reducing the effective sample size.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'E0'

Mean-zero presample innovations, providing initial values for the GARCH(P, Q) model. E0 is a column vector or a matrix with at least model.Q rows to initialize the variance equation. If the number of rows exceeds model.Q, then only the most recent model.Q observations are used. The last row contains the most recent observation.

If E0 is a column vector, then it is applied to each inferred path. If E0 is a matrix, then it needs at least numPaths columns. If the number of columns exceeds numPaths, then only the first numPaths columns are used.

Default: Necessary observations are set to the square root of the average squared value of the offset-adjusted response series Y.

'V0'

Positive presample conditional variances, providing initial values for the GARCH(P,Q) model. V0 is a column vector or a matrix with at least model.P rows to initialize the variance equation. If the number of rows exceeds model.P, then only the most recent model.P observations are used. The last row contains the most recent observation.

If V0 is a column vector, then it is applied to each inferred path. If V0 is a matrix, then it needs at least numPaths columns. If the number of columns exceeds numPaths, then only the first numPaths columns are used.

Default: Necessary observations are set to the average squared value of the offset-adjusted response series Y.

    Notes  

    • NaNs indicate missing values. The toolbox uses listwise deletion to remove missing values in the presample data E0 and V0. That is, E0 and V0 are merged into a composite series, and any row of the combined series with at least one NaN is removed.

    • infer assumes you synchronize presample data such that the last (most recent) observation of each presample series occurs simultaneously.

    • In the absence of user-specified presample observations, initial values of E0 and V0 are derived from the unconditional, or long-run, variance of the offset-adjusted response process Y. This quantity is taken as the sample average of the squared disturbances of the offset-adjusted data Y.

Output Arguments

V

numObs-by-numPaths matrix of conditional variances inferred from the input series Y.

LogL

numPaths-element vector of loglikelihood objective function values associated with the GARCH model specified in model. Each element of LogL is associated with the corresponding path of Y.

Examples

expand all

Infer Conditional Variances

Infer conditional variances from a GARCH(1,1) model with known coefficients. Compare the results from infer when using and not using presample data.

Specify a GARCH(1,1) model with known parameters. Simulate 101 conditional variances and responses (innovations) from the model. Set aside the first observation from each series to use as presample data.

model = garch('Constant',0.01,'GARCH',0.8,'ARCH',0.15);

rng('default');
[Vs,Ys] = simulate(model,101);
Y0 = Ys(1);
V0 = Vs(1);
Y = Ys(2:end);
V = Vs(2:end);

figure
subplot(2,1,1)
plot(V)
title('Conditional Variances')
subplot(2,1,2)
plot(Y)
title('Innovations')

Simulate conditional variances and responses with 110 observations. Set the first 10 observations aside to use as presample innovations.

Infer the conditional variances of Y without using presample data. Compare them to the known (simulated) conditional variances.

Vi = infer(model,Y);

figure
plot(1:100,V,'r','LineWidth',2)
hold on
plot(1:100,Vi,'k:','LineWidth',1.5)
legend('Simulated','Inferred','Location','NorthEast')
title('Inferred Conditional Variances - No Presamples')
hold off

Notice the transient response (discrepancy) in the early time periods due to the absence of presample data.

Infer conditional variances using the set-aside presample innovation, Y0. Compare them to the known (simulated) conditional variances.

Ve = infer(model,Y,'E0',Y0);

figure
plot(1:100,V,'r','LineWidth',2)
hold on
plot(1:100,Ve,'k:','LineWidth',1.5)
legend('Simulated','Inferred','Location','NorthEast')
title('Inferred Conditional Variances - Presample E')
hold off

There is a slightly reduced transient response in the early time periods.

Infer conditional variances using the set-aside presample conditional variance, V0. Compare them to the known (simulated) conditional variances.

Vo = infer(model,Y,'V0',V0);

figure
plot(V)
plot(1:100,V,'r','LineWidth',2)
hold on
plot(1:100,Vo,'k:','LineWidth',1.5)
legend('Simulated','Inferred','Location','NorthEast')
title('Inferred Conditional Variances - Presample V')
hold off

There is a much smaller transient response in the early time periods.

Infer conditional variances using both the presample innovation and conditional variance. Compare them to the known (simulated) conditional variances.

Veo = infer(model,Y,'E0',Y0,'V0',V0);

figure
plot(V)
plot(1:100,V,'r','LineWidth',2)
hold on
plot(1:100,Veo,'k:','LineWidth',1.5)
legend('Simulated','Inferred','Location','NorthEast')
title('Inferred Conditional Variances - Presamples')
hold off

The inferred conditional variances are exact (there is no transient response) when you use sufficient presample innovations and conditional variances.

Infer Loglikelihoods to Conduct a Likelihood Ratio Test

Infer the loglikelihood objective function values for a GARCH(1,1) and GARCH(1,2) model fit to NASDAQ Composite Index returns. Conduct a likelihood ratio test to identify which model is the mode parsimonious, adequate fit.

Load the NASDAQ data included with the toolbox, and convert the index to returns. Set aside the first two observations to use as presample data.

load Data_EquityIdx
nasdaq = Dataset.NASDAQ;
r = price2ret(nasdaq);
r0 = r(1:2);
rn = r(3:end);

Fit a GARCH(1,1) model to the returns, and infer the loglikelihood objective function value.

model1 = garch(1,1);
fit1 = estimate(model1,rn,'E0',r0);
[~,LogL1] = infer(fit1,rn,'E0',r0);

Fit a GARCH(1,2) model to the returns, and infer the loglikelihood objective function value.

model2 = garch(1,2);
fit2 = estimate(model2,rn,'E0',r0);
[~,LogL2] = infer(fit2,rn,'E0',r0);

Conduct a likelihood ratio test, with the more parsimonious GARCH(1,1) model as the null model, and the GARCH(1,2) model as the alternative. The degree of freedom for the test is 1, because the GARCH(1,2) model has one more parameter than the GARCH(1,1) model.

[h,p] = lratiotest(LogL2,LogL1,1)
h =

     0


p =

    0.8890

The null hypothesis is not rejected (h=0). At the 0.05 significance level, the GARCH(1,1) model is not rejected in favor of the GARCH(1,2) model.

References

[1] Bollerslev, T. "Generalized Autoregressive Conditional Heteroskedasticity." Journal of Econometrics. Vol. 31, 1986, pp. 307–327.

[2] Bollerslev, T. "A Conditionally Heteroskedastic Time Series Model for Speculative Prices and Rates of Return." The Review of Economics and Statistics. Vol. 69, 1987, pp. 542–547.

[3] Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. Time Series Analysis: Forecasting and Control. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.

[4] Enders, W. Applied Econometric Time Series. Hoboken, NJ: John Wiley & Sons, 1995.

[5] Engle, R. F. "Autoregressive Conditional Heteroskedasticity with Estimates of the Variance of United Kingdom Inflation." Econometrica. Vol. 50, 1982, pp. 987–1007.

[6] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.

See Also

| | | | |

Was this topic helpful?