WindowSweep: Perform window sweep for BCPA

Description Usage Arguments Value Author(s) See Also Examples

Description

This is the workhorse function of the BCPA. It performs a sweep of the time series, searching for most significant change points and identifying the parsimonious model according to an adjusted BIC.

Usage

1
2
WindowSweep(data, variable, windowsize = 50, windowstep = 1, K = 2,
  tau = TRUE, range = 0.6, progress = TRUE, plotme = FALSE, ...)

Arguments

data

the data to be analyzed. Most typically, output of the GetVT function containing step lengths, absolute and turning angles, etc.

variable

a character string representing the response to apply the BCPA to. For example "V*cos(theta)" for persistence velocity, or "log(V)" for log of velocity.

windowsize

integer size of the analysis window as a number of data points (not time units). Should probably be no smaller than 20.

windowstep

integer step size of analysis. Values greater than 1 speed the analysis up.

K

senstivity parameter for the adjusted BIC. Smaller values make for a less sensitive model selection, i.e. more likely that the null model of no significant changes will be selected.

tau

a logical indicating whether the autocorrelation "rho" or the characteristic time "tau" should be estimated.

range

a number between 0 and 1 that determines the extent of each window that is scanned for changepoints. I.e., if the window is 100 datapoints long, at the default range=0.6, changepoints will be scanned between 20 and 80.

progress

logical - whether or not to output a progress bar as the analysis is being performed.

plotme

logical - whether or not to plot the analysis as it is happening. This slows the analysis considerably, especially in non-dynamic graphic environments like RStudio.

...

additional parameters to be passed to the PartitionParameters function.

Value

an object of class windowsweep, which is a list containing:

ws

a data frame containing the change point, selected model, and parameter estimates

x

the response variable

t

the time variable - in the units specified in the data object

t.POSIX

the time variable as a POSIX objects (contianing Y-M-D H:S)

windowsize

the window size

windowstep

the window step size

Author(s)

Eliezer Gurarie

See Also

for internal functions: GetModels, GetBestBreak, GetDoubleL; for summarizing output: ChangePointSummary; for plotting output: plot.bcpa

Examples

1
2
3
4
5
6
7
8
9
data(Simp)
plot(Simp)
Simp.VT <- GetVT(Simp)
Simp.ws <- WindowSweep(Simp.VT, "V*cos(Theta)", windowsize = 50, windowstep = 1, progress=TRUE)
plot(Simp.ws, threshold=7)
plot(Simp.ws, type="flat", clusterwidth=3)
PathPlot(Simp, Simp.ws)
PathPlot(Simp, Simp.ws, type="flat")
DiagPlot(Simp.ws)

Example output

Loading required package: Rcpp
Loading required package: plyr

  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=========                                                             |  14%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |============================                                          |  41%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===============================================                       |  68%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |==================================================================    |  95%
Warning message:
In plot.xy(xy.coords(x, y), type = type, ...) :
  plot type 'black' will be truncated to first character

bcpa documentation built on May 1, 2019, 10:30 p.m.