rcoint: Random generation of cointegrated sequences

rcointR Documentation

Random generation of cointegrated sequences

Description

Generates a random pair of cointegrated sequences

Usage

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)

Arguments

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

Details

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]

Value

Returns a two-column data.frame containing the randomly generated cointegrated sequences.

Author(s)

Matthew Clegg matthewcleggphd@gmail.com

See Also

rar1 sim.egcm egcm

Examples

xy <- rcoint(1000, alpha = 1, beta = 2, rho = 0.8)
egcm(xy)

matthewclegg/egcm documentation built on March 5, 2023, 6:33 a.m.