compose.mar1s {mar1s} | R Documentation |
Compose and Decompose MAR(1)S Process
Description
compose.mar1s
composes MAR(1)S process realization by given
vector of log-innovations.
decompose.mar1s
extracts MAR(1)S process components from time
series.
Usage
compose.mar1s(object, loginnov, start.time = head(time(loginnov), 1),
xreg.absdata = NULL, init.absdata = NULL)
decompose.mar1s(object, absdata, start.time = head(time(absdata), 1),
init.absdata = rep(NA, NCOL(absdata)))
Arguments
object |
An object of class |
loginnov |
A univariate time series containing the log-innovations. |
absdata |
A univariate or multivariate time series containing the process realization. |
start.time |
The sampling time for the first simulation step. |
xreg.absdata |
A matrix-like object with row count = |
init.absdata |
A vector specifying the initial values of the process. If
|
Details
Multiplicative AR(1) with Seasonal (MAR(1)S) process is defined as
x_t = exp(s_t + y_t)
y_{t, 1} = b_1 y_{t, 2} + \dots + b_k y_{t, k + 1} + z_t
z_t = a z_{t-1} + e_t
where
s_t
is the log-seasonal component,
y_t
is the AR(1) (log-stochastic) component,
e_t
is the log-residuals (random component).
Value
absdata |
Realization of the process (a univariate or multivariate time series object). |
logdata |
Logarithm of |
logstoch |
Log-stochastic component (a univariate or multivariate time series object). |
logresid |
Random component (a univariate time series object). |
Note
decompose.mar1s
and fit.mar1s
compute the random
component in different ways: decompose.mar1s
uses filter
while fit.mar1s
saves the residuals returned by arima
.
The results may be different in:
- the first value:
decompose.mar1s
uses specifiedinit.absdata
whilearima
always assumes zero initial values for the fitted process;- non-finite values:
decompose.mar1s
handles non-finite values more accurately.
See Also
compose.ar1
for the AR(1) with external regressors
processes, fit.mar1s
for fitting MAR(1)S process to
data, sim.mar1s
for MAR(1)S process simulation and
prediction.
Examples
data(forest.fire, package = "mar1s")
data(nesterov.index, package = "mar1s")
## Simple
mar1s <- fit.mar1s(window(forest.fire, 1969, 1989))
x <- ts(rnorm(365, sd = mar1s$logresid.sd), start = c(1989, 1))
plot(compose.mar1s(mar1s, x)$absdata)
decomp <- decompose.mar1s(mar1s, mar1s$decomposed$absdata)
delta <- abs(nan2na(mar1s$decomposed$logresid) -
nan2na(decomp$logresid))
stopifnot(all(na.exclude(tail(delta, -1)) < 1E-6))
## External regressors
mar1s <- fit.mar1s(window(forest.fire, 1969, 1989),
window(nesterov.index[, "mean"], 1969, 1989))
x <- rnorm(365, sd = mar1s$logresid.sd)
xreg <- window(nesterov.index[, "mean"], 1989.001, 1990)
plot(compose.mar1s(mar1s, x, c(1989, 1), xreg)$absdata)
decomp <- decompose.mar1s(mar1s, mar1s$decomposed$absdata)
delta <- abs(mar1s$decomposed$logstoch - decomp$logstoch)
stopifnot(all(na.exclude(delta) < 1E-6))
delta <- abs(nan2na(mar1s$decomposed$logresid) -
nan2na(decomp$logresid))
stopifnot(all(na.exclude(tail(delta, -1)) < 1E-6))