Generates random samples of the likelihood ratio for the partially autoregressive model
sample.likelihood_ratio.par(n = 500, rho = 0.8, sigma_M = 1, sigma_R = 1,
nrep = 1000, use.multicore = TRUE, robust = FALSE,
nu = par.nu.default(), seed.start = 0)
Length of the randomly generated sequence. Possibly a vector.
The coefficient of mean reversion. Possibly a vector.
Standard deviation of the innovations of the mean-reverting process. Possibly a vector.
Standard deviation of the innovations of the random walk process. Possibly a vector.
Number of repetitions to perform
If TRUE
, then the parallel
package is
used to speed up processing.
If TRUE
, then sequences containing t-distributed errors are
generated, and robust fits are performed. Possibly a vector.
If robust
is TRUE
, then this is the degrees-of-freedom
parameter to be used. Possibly a vector.
Starting seed to use for the random number generator.
A data.frame
with the following columns
The length of the sequence
The value of rho
that was used for generating the sequence
The value of sigma_M
that was used for generating the sequence
The value of sigma_R
that was used for generating the sequence
0 if normally distributed innovations, 1 if t-distributed innovations
If t-distributed innovations, the value of the degrees of freedom parameter
The value used for seeding the random number generator
The value of rho
estimated using the pure random walk model (always 0)
The value of sigma_M
estimated using the pure random walk model (always 0)
The value of sigma_R
estimated using the pure random walk model
The negative log likelihood of the fit obtained with the pure random walk model
The value of rho
estimated using the pure mean-reversion model
The value of sigma_M
estimated using the pure mean-reversion model
The value of sigma_R
estimated using the pure mean-reversion model (always 0)
The negative log likelihood of the fit obtained with the pure mean-reversion model
The value of rho
estimated using the PAR model
The value of sigma_M
estimated using the PAR model
The value of sigma_R
estimated using the PAR model
The negative log likelihood of the fit obtained with the PAR model
The log likelihood ratio of the random walk model vs. the PAR model
The log likelihood ratio of the mean-reversion model vs. the PAR model
Statistic computed by the KPSS test (see ur.kpss
)
p-value associated with kpss_stat
Proportion of variance attributable to mean reversion found for PAR fit
The purpose of this function is to facilitate studying the behavior of
the fit.par
function by generating random partially autoregressive sequences
and determining the maximum likelihood fits to them. For each combination of
parameter values given by n
, rho
, sigma_M
, sigma_R
,
robust
and nu
, generates nrep
random partially autoregressive
sequences with these parameters. Then, uses fit.par
to fit the sequence
using the partially autoregressive model, the pure random walk model and the
pure mean reversion model. Returns a data.frame
containing the results
of the fits.
Clegg, Matthew. Modeling Time Series with Both Permanent and Transient Components using the Partially Autoregressive Model. Available at SSRN: http://ssrn.com/abstract=2556957
# NOT RUN {
sample.likelihood_ratio.par(500, c(0.5,0.75), 1, c(1,2),nrep=3)
# }
Run the code above in your browser using DataLab