Title: | Methods for Fitting and Simulating Non-Stationary ARFIMA Models |
---|---|
Description: | Routines for fitting and simulating data under autoregressive fractionally integrated moving average (ARFIMA) models, without the constraint of covariance stationarity. Two fitting methods are implemented, a pseudo-maximum likelihood method and a minimum distance estimator. Mayoral, L. (2007) <doi:10.1111/j.1368-423X.2007.00202.x>. Beran, J. (1995) <doi:10.1111/j.2517-6161.1995.tb02054.x>. |
Authors: | Benjamin Groebe [aut, cre] |
Maintainer: | Benjamin Groebe <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.2.0.0 |
Built: | 2024-12-09 06:42:06 UTC |
Source: | CRAN |
Simulates a series under the given ARFIMA model by applying an MA filter to a series of innovations.
arfima.sim( n, d = 0, ar = numeric(), ma = numeric(), mu = 0, sig2 = 1, stat.int = FALSE, n.burn, innov, exact.innov = TRUE )
arfima.sim( n, d = 0, ar = numeric(), ma = numeric(), mu = 0, sig2 = 1, stat.int = FALSE, n.burn, innov, exact.innov = TRUE )
n |
Desired series length. |
d |
Fractional differencing parameter. |
ar |
Vector of autoregressive parameters. |
ma |
Vector of moving average parameters, following the same sign convention as |
mu |
Mean of process. By default, added after integer integration but before burn-in truncation (see |
sig2 |
Innovation variance if innovations not provided. |
stat.int |
Controls integration for non-stationary values of |
n.burn |
Number of burn-in steps. If not given, chosen based off presence of long memory (i.e. |
innov |
Series of innovations. Drawn from normal distribution if not given. |
exact.innov |
Whether to force the exact innovation series to be used. If |
The model is defined by values for the AR and MA parameters ( and
, respectively), along with the fractional differencing parameter d. When
, then the integer part is taken as
, and the remainder (between -0.5 and 0.5) stored as d. For
, the model is:
where B is the backshift operator () and
is the innovation series. When
, the model is defined by:
When stat.int = FALSE
, the differencing filter applied to the innovations is not split into parts, and the series model follows the first equation regardless of the value of d. This means that is added to the series after filtering and before any truncation. When
stat.int = TRUE
, is generated from filtered residuals,
is added, and the result is cumulatively summed m times. For non-zero mean and
, this will yield a polynomial trend in the resulting data.
Note that the burn-in length may affect the distribution of the sample mean, variance, and autocovariance. Consider this when generating ensembles of simulated data
A numeric vector of length n.
## Generate ARFIMA(1,d,0) series with Gaussian innovations x <- arfima.sim(1000, d=0.6, ar=c(-0.4)) ## Generate ARFIMA(1,d,0) series with uniform innovations. innov.series <- runif(1000, -1, 1) x <- arfima.sim(1000, d=0.6, ar=c(-0.4), innov=innov.series, exact.innov=TRUE)
## Generate ARFIMA(1,d,0) series with Gaussian innovations x <- arfima.sim(1000, d=0.6, ar=c(-0.4)) ## Generate ARFIMA(1,d,0) series with uniform innovations. innov.series <- runif(1000, -1, 1) x <- arfima.sim(1000, d=0.6, ar=c(-0.4), innov=innov.series, exact.innov=TRUE)
Fits an ARFIMA(p,d,q) model to a time series using a minimum distance estimator. For details see Mayoral (2007).
mde.arfima( y, p = 1, q = 0, d.range = c(0, 1), start, lag.max = floor(sqrt(length(y))), incl.mean = TRUE, verbose = FALSE, method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), control = list() )
mde.arfima( y, p = 1, q = 0, d.range = c(0, 1), start, lag.max = floor(sqrt(length(y))), incl.mean = TRUE, verbose = FALSE, method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), control = list() )
y |
Numeric vector of the time series. |
p |
Autoregressive order. |
q |
Moving average order. |
d.range |
Range of allowable values for fractional differencing parameter. Smallest value must be greater than -1. |
start |
Named vector of length 1 + |
lag.max |
Maximum lag to use when calculating the residual autocorrelations. For details see Mayoral (2007). |
incl.mean |
Whether or not to include a mean term in the model. The default value of |
verbose |
Whether to print summary of fit. |
method |
Method for |
control |
List of additional arguments for |
A list containing:
pars
|
A numeric vector of parameter estimates. |
std.errs |
A numeric vector of standard errors on parameters. |
cov.mat |
Parameter covariance matrix (excluding mean). |
fit.obj |
optim fit object. |
p.val |
Ljung-Box p-value for fit. |
residuals |
Fit residuals. |
This method makes no assumptions on the distribution of the innovation series, and the innovation variance does not factor into the covariance matrix of parameter estimates. For this reason, it is not included in the results, but can be estimated from the residuals—see Mayoral (2007).
Mayoral, L. (2007). Minimum distance estimation of stationary and non-stationary ARFIMA processes. The Econometrics Journal, 10, 124-148. doi: 10.1111/j.1368-423X.2007.00202.x
mle.arfima
for psuedo-maximum likelihood estimation.
set.seed(1) x <- arfima.sim(1000, d=0.6, ar=c(-0.4)) fit <- mde.arfima(x, p=1, incl.mean=FALSE, verbose=TRUE) ## Fit Summary ## -------------------- ## Ljung-Box p-val: 0.276 ## d ar.1 ## est 0.55031 -0.39261 ## err 0.03145 0.03673 ## ## Correlation Matrix for ARFIMA Parameters ## d ar.1 ## d 1.0000 0.6108 ## ar.1 0.6108 1.0000
set.seed(1) x <- arfima.sim(1000, d=0.6, ar=c(-0.4)) fit <- mde.arfima(x, p=1, incl.mean=FALSE, verbose=TRUE) ## Fit Summary ## -------------------- ## Ljung-Box p-val: 0.276 ## d ar.1 ## est 0.55031 -0.39261 ## err 0.03145 0.03673 ## ## Correlation Matrix for ARFIMA Parameters ## d ar.1 ## d 1.0000 0.6108 ## ar.1 0.6108 1.0000
Fits an ARFIMA(p,d,q) model to a time series using a pseudo-maximum likelihood estimator. For details see Beran (1995).
mle.arfima( y, p = 1, q = 0, d.range = c(0, 1), start, incl.mean = TRUE, verbose = FALSE, method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), control = list() )
mle.arfima( y, p = 1, q = 0, d.range = c(0, 1), start, incl.mean = TRUE, verbose = FALSE, method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), control = list() )
y |
Numeric vector of the time series. |
p |
Autoregressive order. |
q |
Moving average order. |
d.range |
Range of allowable values for fractional differencing parameter. Smallest value must be greater than -1. |
start |
Named vector of length 1 + |
incl.mean |
Whether or not to include a mean term in the model. The default value of |
verbose |
Whether to print summary of fit. |
method |
Method for |
control |
List of additional arguments for |
A list containing:
pars
|
A numeric vector of parameter estimates. |
std.errs |
A numeric vector of standard errors on parameters. |
cov.mat |
Parameter covariance matrix (excluding mean). |
fit.obj |
optim fit object. |
p.val |
Ljung-Box p-value for fit. |
residuals |
Fit residuals. |
Beran, J. (1995). Maximum Likelihood Estimation of the Differencing Parameter for Short and Long Memory Autoregressive Integrated Moving Average Models. Journal of the Royal Statistical Society. Series B (Methodological), 57, No. 4, 659-672. doi: 10.1111/j.2517-6161.1995.tb02054.x
mde.arfima
for minimum distance estimation.
set.seed(1) x <- arfima.sim(1000, d=0.6, ar=c(-0.4)) fit <- mle.arfima(x, p=1, incl.mean=FALSE, verbose=TRUE) ## Fit Summary ## -------------------- ## Ljung-Box p-val: 0.263 ## sig2 d ar.1 ## est 1.09351 0.53933 -0.37582 ## err 0.05343 0.04442 0.05538 ## ## Correlation Matrix for ARFIMA Parameters ## sig2 d ar.1 ## sig2 1.0000 -0.3349 0.4027 ## d -0.3349 1.0000 -0.8318 ## ar.1 0.4027 -0.8318 1.0000
set.seed(1) x <- arfima.sim(1000, d=0.6, ar=c(-0.4)) fit <- mle.arfima(x, p=1, incl.mean=FALSE, verbose=TRUE) ## Fit Summary ## -------------------- ## Ljung-Box p-val: 0.263 ## sig2 d ar.1 ## est 1.09351 0.53933 -0.37582 ## err 0.05343 0.04442 0.05538 ## ## Correlation Matrix for ARFIMA Parameters ## sig2 d ar.1 ## sig2 1.0000 -0.3349 0.4027 ## d -0.3349 1.0000 -0.8318 ## ar.1 0.4027 -0.8318 1.0000