Learn R Programming

gets (version 0.3)

iim: Make Indicator Matrices (Impulses, Steps, Trends)

Description

Auxiliary functions to make, respectively, matrices of impulse indicators (iim), step indicators (sim) and trend indicators (tim)

Usage

##make matrix of impulse indicators:
iim(x, which.ones = NULL)

##make matrix of step indicators:
sim(x, which.ones = NULL)

##make matrix of trend indicators:
tim(x, which.ones = NULL, log.trend = FALSE)

Arguments

x
either an integer (the length of the series in question) or the series itself
which.ones
the locations of the impulses. If NULL (the default), then all impulses are returned
log.trend
logical. If TRUE, then the natural log is applied on the trends

Value

  • A zoo matrix containing the impulses

Details

If x is a series or vector of observations, then the index of x will be used as for the zoo, and for the labelling of the impulses. Note: For sim and tim the first indicator is removed, since it is exactly colinear with the others.

See Also

isat, zoo

Examples

Run this code
##generate series:
y <- rnorm(50)

##make matrix of impulse indicators:
mIIM <- iim(50)

##make matrix of step indicators:
mSIM <- sim(y)

##make matrix of trend indicators, but only every third:
mTIM <- tim(y, which.ones=seq(1,50,3))

Run the code above in your browser using DataLab