Learn R Programming

egcm (version 1.0.8)

sim.egcm: Generate simulated data from an Engle-Granger cointegration model

Description

Given an Engle-Granger cointegration model and the number of steps to simulate, generates a simulated realization of that model for the specified number of steps.

Usage

sim.egcm(E, nsteps, X0, Y0)

Arguments

E
the Engle-Granger model to be simulated. See egcm
nsteps
the number of steps to simulate
X0
the starting value of X to be used in the simulation. If not specified, uses the last value of X in E.
Y0
the starting value of Y to be used in the simulation. If not specified, uses the last value of Y in E.

Value

Returns a two-column data.frame, where the first column contains the simulated values of X, and the second column contains the simulated values of Y.

See Also

egcm rcoint

Examples

Run this code
# Generate a random pair of cointegrated vectors
cv1 <- rcoint(1000)
# Construct a cointegration model from them
e1 <- egcm(cv1)
# Simulate the model for an additional 1000 steps
cv2 <- sim.egcm(e1, 1000)
# Construct a cointegration model from the simulated data
e2 <- egcm(cv2)
# Compare the original model to the model obtained from simulation
e1
e2

Run the code above in your browser using DataLab