rcoint | R Documentation |
Generates a random pair of cointegrated sequences
rcoint(n, alpha = runif(1, -10, 10), beta = runif(1, -10, 10), rho = runif(1, 0, 1), sd_eps = 1, sd_delta = 1, X0=0, Y0=0)
n |
number of observations in each sequence |
alpha |
constant term of linear relation |
beta |
slope term of linear relation |
rho |
coefficient of mean reversion |
sd_eps |
standard deviation of innovations in first sequence |
sd_delta |
standard deviation of innovations in residual sequence |
X0 |
initial value of first sequence |
Y0 |
initial value of second sequence |
Generates a random pair of cointegrated sequences. The sequences are constructed
by first generating two random sequences that are independent and normally distributed.
The elements of the first sequence, epsilon[i],
have standard deviation sd_eps
,
while those of the second sequence, delta[i],
have standard deviation sd_delta
.
Having generated these two sequences, the cointegrated sequences X[i]
and
Y[i]
are generated according to the following relations:
X[i] = X[i-1] + epsilon[i]
R[i] = rho * R[i-1] + delta[i]
Y[i] = alpha + beta * X[i] + R[i]
Returns a two-column data.frame containing the randomly generated cointegrated sequences.
Matthew Clegg matthewcleggphd@gmail.com
rar1
sim.egcm
egcm
xy <- rcoint(1000, alpha = 1, beta = 2, rho = 0.8) egcm(xy)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.