mwar.ani {animation}R Documentation

Demonstration for “Moving Window Auto-Regression”

Description

This function just fulfills a very naive idea about moving window regression using rectangles to denote the ``windows'' and move them, and the corresponding AR(1) coefficients as long as rough confidence intervals are computed for data points inside the ``windows'' during the process of moving.

Usage

mwar.ani(x, k = 15, conf = 2, control = ani.control(), ...)

Arguments

x univariate time-series (a single numerical vector); default to be sin(seq(0, 2 * pi, length = 50)) + rnorm(50, sd = 0.2)
k an integer of the window width
conf a positive number: the confidence intervals are computed as [ar1 - conf*s.e., ar1 + conf*s.e.]
control control parameters for the animation; see ani.control
... other arguments passed to ani.control

Details

The AR(1) coefficients are computed by arima.

Value

A list containing

phi the AR(1) coefficients
L lower bound of the confidence interval
U upper bound of the confidence interval

Author(s)

Yihui Xie

References

Robert A. Meyer, Jr. Estimating coefficients that change over time. International Economic Review, 13(3):705-710, 1972.

See Also

arima

Examples

# moving window along a sin curve 
mwar.ani(interval = 0.3)

# for the data 'pageview'
data(pageview)
mwar.ani(pageview$visits, k = 30, interval = 0.2) 

## Not run:  

# HTML animation page
ani.start()
mwar.ani(interval = 0.2, width = 600, height = 500) 
ani.stop() 

## End(Not run)

[Package animation version 0.2-0 Index]