rpar: Random partially autoregressive sequence

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Random partially autoregressive sequence

Usage

1
2
rpar(n, rho, sigma_M, sigma_R, M0 = 0, R0 = 0, 
  include.state = FALSE, robust = FALSE, nu = par.nu.default())

Arguments

n

Length of sequence to generate

rho

The coefficient of mean reversion

sigma_M

The standard deviation of the innovations of the mean-reverting component

sigma_R

The standard deviation of the innovations of the random walk component

M0

Initial state of mean-reverting component

R0

Initial state of random walk component

include.state

If TRUE, a data.frame is returned containing the states of the mean-reverting and random walk components. Otherwise, a numeric vector is returned containing the state of the system. Default: FALSE.

robust

If TRUE, innovations are t-distributed. Otherwise, they are normally distributed. Default: FALSE.

nu

If robust is TRUE, then this is the degrees of freedom parameter to be used in the t-distributed innovations.

Details

Generates a random sequence according to the specification of the partially autoregressive model. The partially autoregressive model is given as

X[t] = M[t] + R[t]

M[t] = rho * M[t-1] + epsilon_M[t]

R[t] = R[t-1] + epsilon_R[t]

-1 < rho < 1

To generate the random sequence, the sequences epsilon_M[t] and epsilon_R[t] are first generated. These are then used to build up the sequences M[t], R[t] and X[t].

Value

If include.state is FALSE, then returns the sequence X[t]. Otherwise, returns a data.frame with the following columns:

X

State of the system

M

State of the mean-reverting component

R

State of the random walk component

eps_M

Innovations in the mean-reverting component

eps_R

Innovations in the random walk component

Author(s)

Matthew Clegg matthewcleggphd@gmail.com

References

Clegg, Matthew. Modeling Time Series with Both Permanent and Transient Components using the Partially Autoregressive Model. Available at SSRN: http://ssrn.com/abstract=2556957

See Also

fit.par

Examples

1
2
3
4
5
6
set.seed(1)
x <- rpar(10000, 0.5, 2, 1)
library(tseries)
adf.test(x)      # Seems to contain a unit root, as expected
estimate.par(x)  # Estimate parameters using lagged variances
fit.par(x)       # Maximum likelihood estimate

partialAR documentation built on April 14, 2020, 6:05 p.m.