Learn R Programming

tfarima (version 0.4.1)

InterventionVar: Intervention variables

Description

`InterventionVar()` creates pulse, step, or ramp variables at a given date.

Usage

InterventionVar(Y, date, type = c("P", "S", "R"), n.ahead = 0)

Value

A `ts` intervention variable.

Arguments

Y

A `ts` object used to determine start, length and frequency.

date

Either a single positive index within the sample, or a vector `c(year, month)` for monthly series. For non-seasonal series, `c(year)` is also accepted.

type

One of `"P"` (pulse), `"S"` (step), or `"R"` (ramp = cumulative step).

n.ahead

Integer. Extra observations to extend the sample.

References

Box, G.E.P. and Tiao, G.C. (1975) “Intervention analysis with applications to economic and environmental problems”, *JASA*, 70(349), 70–79.

Examples

Run this code
# Pulse at March 1958:
P <- InterventionVar(AirPassengers, date = c(1958, 3), type = "P")
# Or by index within the extended sample (here no extension):
P2 <- InterventionVar(AirPassengers, date = 123, type = "P")

Run the code above in your browser using DataLab