Description Usage Arguments Details Value Author(s) References See Also Examples
Random partially autoregressive sequence
1 2 |
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 |
robust |
If TRUE, innovations are t-distributed. Otherwise, they are
normally distributed. Default: |
nu |
If |
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]
.
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 |
Matthew Clegg matthewcleggphd@gmail.com
Clegg, Matthew. Modeling Time Series with Both Permanent and Transient Components using the Partially Autoregressive Model. Available at SSRN: http://ssrn.com/abstract=2556957
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.