# moving window along a sin curve
oopt = ani.options(interval = 0.1, nmax = 50)
op = par(mar = c(2, 3, 1, 0.5), mgp = c(1.5, 0.5, 0))
mwar.ani(lty.rect = 3, pch = 21, col = "red", bg = "yellow",type='o')
# for the data 'pageview'
ani.options(interval = 0.1, nmax = 50)
data(pageview)
mwar.ani(pageview$visits, k = 30)
par(op)
# HTML animation page
ani.options(ani.height = 500, ani.width = 600, nmax = 50,
title = "Demonstration of Moving Window Auto-Regression",
description = "Compute the AR(1) coefficient for the data in the
window and plot the confidence intervals. Repeat this step as the
window moves.")
ani.start()
par(mar = c(2, 3, 1, 0.5), mgp = c(1.5, 0.5, 0))
mwar.ani(lty.rect = 3, pch = 21, col = "red", bg = "yellow",type='o')
ani.stop()
ani.options(oopt)
Run the code above in your browser using DataLab