sim.mar1s: Simulate from MAR(1)S Process

Description Usage Arguments Value See Also Examples

Description

sim.mar1s simulates from MAR(1)S process.

predict.mar1s is a wrapper around sim.mar1s which estimates confidence intervals for the future values of the MAR(1)S process.

Usage

1
2
3
4
5
6
7
sim.mar1s(object, n.ahead = 1, n.sim = 1, start.time = 0,
          xreg.absdata = NULL, init.absdata = NULL)

## S3 method for class 'mar1s'
predict(object, n.ahead = 1, start.time = 0,
        xreg.absdata = NULL, init.absdata = NULL,
        probs = c(0.05, 0.5, 0.95), n.sim = 1000, ...)

Arguments

object

An object of class "mar1s" specifying the model parameters.

n.ahead

Number of steps ahead at which to simulate/predict.

n.sim

Number of simulations.

start.time

The sampling time for the first simulation step.

xreg.absdata

A matrix-like object with row count = n.ahead, specifying the values for the external regressors. If NULL, default values are used.

init.absdata

A vector specifying the initial values of the process. If NULL, default values are used.

probs

A vector of probabilities.

...

Arguments from previous methods.

Value

For sim.mar1s, a vector of simulated values.

For predict.mar1s, a vector of estimated quantiles.

See Also

compose.mar1s for MAR(1)S process formal definition and composition/decomposition functions, fit.mar1s for fitting MAR(1)S process to data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
data(forest.fire, package = "mar1s")
data(nesterov.index, package = "mar1s")

## Univariate
mar1s <- fit.mar1s(forest.fire)

sim.mar1s(mar1s)
sim.mar1s(mar1s, n.sim = 6)
sim.mar1s(mar1s, n.ahead = 3)

predict(mar1s)
predict(mar1s, n.ahead = 10)
predict(mar1s, init.absdata = 100)

t <- seq(1/12, 11/12, 1/6) 
p <- mapply(predict, start.time = t,
            MoreArgs = list(object = mar1s, probs = c(0.05, 0.95)))
plot(exp(mar1s$logseasonal), ylim = c(0, max(p)),
     ylab = "Forest fire")
arrows(t, p[1, ], t, p[2, ],
       code = 3, angle = 90, length = 0.05)

## External regressors
mar1s <- fit.mar1s(forest.fire, nesterov.index[, "mean"])

sim.mar1s(mar1s)
sim.mar1s(mar1s, n.sim = 6)

predict(mar1s)
predict(mar1s, xreg.absdata = 10000)
predict(mar1s, init.absdata = c(100, 1000))

aparamon/mar1s documentation built on May 5, 2019, 6:54 p.m.