Main Content

Simulate GARCH Models

This example shows how to simulate from a GARCH process with and without specifying presample data. The sample unconditional variances of the Monte Carlo simulations approximate the theoretical GARCH unconditional variance.

Step 1. Specify a GARCH model.

指定一个GARCH(1,1)模型 ε t = σ t z t , where the distribution of z t is Gaussian and

σ t 2 = 0 . 0 1 + 0 . 7 σ t - 1 2 + 0 . 2 5 ε t - 1 2 .

Mdl = garch('Constant',0.01,'GARCH',0.7,'ARCH',0.25)
Mdl = garch with properties: Description: "GARCH(1,1) Conditional Variance Model (Gaussian Distribution)" Distribution: Name = "Gaussian" P: 1 Q: 1 Constant: 0.01 GARCH: {0.7} at lag [1] ARCH: {0.25} at lag [1] Offset: 0

Step 2. Simulate from the model without using presample data.

模拟5路径长度为100的GARCH (1,1) model, without specifying any presample innovations or conditional variances. Display the first conditional variance for each of the five sample paths. The model being simulated does not have a mean offset, so the response series is an innovation series.

rngdefault;% For reproducibility[Vn,Yn] = simulate(Mdl,100,'NumPaths',5); Vn(1,:)% Display variances
ans =1×50.1645 0.3182 0.4051 0.1872 0.1551
figure subplot(2,1,1) plot(Vn) xlim([0,100]) title('Conditional Variances') subplot(2,1,2) plot(Yn) xlim([0,100]) title('Innovations')

Figure contains 2 axes objects. Axes object 1 with title Conditional Variances contains 5 objects of type line. Axes object 2 with title Innovations contains 5 objects of type line.

The starting conditional variances are different for each realization because no presample data was specified.

Step 3. Simulate from the model using presample data.

Simulate five paths of length 100 from the model, specifying the one required presample innovation and conditional variance. Display the first conditional variance for each of the five sample paths.

rngdefault; [Vw,Yw] = simulate(Mdl,100,'NumPaths',5,...'E0',0.05,'V0',0.001); Vw(1,:)
ans =1×50.0113 0.0113 0.0113 0。0113 0.0113
figure subplot(2,1,1) plot(Vw) xlim([0,100]) title('Conditional Variances') subplot(2,1,2) plot(Yw) xlim([0,100]) title('Innovations')

Figure contains 2 axes objects. Axes object 1 with title Conditional Variances contains 5 objects of type line. Axes object 2 with title Innovations contains 5 objects of type line.

All five sample paths have the same starting conditional variance, calculated using the presample data.

Note that even with the same starting variance, the realizations of the innovation series have different starting points. This is because each ε 1 is a random draw from a Gaussian distribution with mean 0 and variance σ 1 = 0 . 0 1 1 3 .

Step 4. Look at the unconditional variances.

Simulate 10,000 sample paths of length 500 from the specified GARCH model. Plot the sample unconditional variances of the Monte Carlo simulations, and compare them to the theoretical unconditional variance,

σ ε 2 = κ ( 1 - γ 1 - α 1 ) = 0 . 0 1 ( 1 - 0 . 7 - 0 . 2 5 ) = 0 . 2 .

sig2 = 0.01/(1-0.7-0.25); rngdefault; [V,Y] = simulate(Mdl,500,'NumPaths',10000); figure plot(var(Y,0,2),'Color',[.7,.7,.7],'LineWidth',1.5) xlim([0,500]) holdonplot(1:500,ones(500,1)*sig2,'k--','LineWidth',2) legend('Simulated','Theoretical','Location','NorthWest') title('Unconditional Variance') holdoff

Figure contains an axes object. The axes object with title Unconditional Variance contains 2 objects of type line. These objects represent Simulated, Theoretical.

The simulated unconditional variances fluctuate around the theoretical unconditional variance.

See Also

Objects

Functions

Related Examples

More About