V = simulate(model,numObs)
[V,Y] = simulate(model,numObs)
[V,Y] = simulate(model,numObs,Name,Value)
Positive integer indicating the number of observations (rows) generated for each path of outputs V and Y.
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.
Positive integer indicating the number of sample paths (columns) generated for outputs V and Y.
Mean-zero presample innovations, providing initial values for the GJR(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 simulated 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 an independent sequence of disturbances with mean zero and standard deviation equal to the unconditional standard deviation of the GJR process.
Positive presample conditional variances, providing initial values for the GJR(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 simulated 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 equal to the unconditional variance of the GJR process.
numObs-by-NumPaths matrix of conditional variances of the mean-zero innovations associated with Y.
numObs-by-NumPaths matrix of time series response data. Y usually represents a time series of innovations with mean zero and conditional variances given in V (a continuation of the presample 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 the input model includes an offset, the offset is added to the underlying mean-zero innovations such that Y represents a time series of offset-adjusted innovations.
Simulate conditional variance and response paths from a GJR(1,1) model.
Specify a GJR(1,1) model with known parameters.
model = gjr('Constant',0.001,'GARCH',0.7,'ARCH',0.2,... 'Leverage',0.1);
Simulate 500 sample paths, each with 100 observations.
rng('default') [V,Y] = simulate(model,100,'NumPaths',500); figure subplot(2,1,1) plot(V) title('Simulated Conditional Variances') subplot(2,1,2) plot(Y) title('Simulated Responses (Innovations)')
The simulated responses look like draws from a stationary stochastic process.
Plot the 2.5th, 50th (median), and 97.5th percentiles of the simulated conditional variances.
lower = prctile(V,2.5,2); middle = median(V,2); upper = prctile(V,97.5,2); figure plot(1:100,lower,'r:',1:100,middle,'k',... 1:100, upper,'r:','LineWidth',2) legend('95% Interval','Median') title('Approximate 95% Intervals')
The intervals are asymmetric due to positivity constraints on the conditional variance.
Simulate conditional variances of the daily NASDAQ Composite Index returns for 500 days. Use the simulations to make forecasts and approximate 95% forecast intervals.
Load the NASDAQ data included with the toolbox. Convert the index to returns.
load Data_EquityIdx nasdaq = Dataset.NASDAQ; r = price2ret(nasdaq); N = length(r);
Fit a GJR(1,1) model to the entire data set. Infer conditional variances to use as presample conditional variances for the forecast simulation.
model = gjr(1,1); fit = estimate(model,r); V0 = infer(fit,r);
Simulate 1000 sample paths with 500 observations each. Use the observed returns and inferred conditional variances as presample data.
rng('default') Vs = simulate(fit,500,'NumPaths',1000,'E0',r,'V0',V0);
Plot the simulation mean forecast and approximate 95% forecast intervals, along with the conditional variances inferred from the data.
lower = prctile(Vs,2.5,2); upper = prctile(Vs,97.5,2); mn = mean(Vs,2); figure h1 = plot(V0,'Color',[.7,.7,.7]); hold on h2 = plot(N+1:N+500,lower,'r:','LineWidth',1.5); plot(N+1:N+500,upper,'r:','LineWidth',1.5) h3 = plot(N+1:N+500,mn,'k','LineWidth',2); xlim([0,N+500]) legend([h1,h2,h3],'Inferred',... '95% Forecast Intervals',... 'Simulation Mean','Location','Northwest') title('Simulated Conditional Variance Forecasts') hold off
The mean conditional variance approaches an asymptote as the forecast horizon increases.
 Bollerslev, T. "Generalized Autoregressive Conditional Heteroskedasticity." Journal of Econometrics. Vol. 31, 1986, pp. 307–327.
 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.
 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.
 Enders, W. Applied Econometric Time Series. Hoboken, NJ: John Wiley & Sons, 1995.
 Engle, R. F. "Autoregressive Conditional Heteroskedasticity with Estimates of the Variance of United Kingdom Inflation." Econometrica. Vol. 50, 1982, pp. 987–1007.
 Glosten, L. R., R. Jagannathan, and D. E. Runkle. "On the Relation between the Expected Value and the Volatility of the Nominal Excess Return on Stocks." The Journal of Finance. Vol. 48, No. 5, 1993, pp. 1779–1801.
 Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.