testCP | R Documentation |
Identifies appropriate models on either side of a change point
testCP( Z, T, cp, start, end, modelset = "all", spline = FALSE, criterion = "BIC", ... )
Z |
location |
T |
time of data |
cp |
change point |
start |
beginning time of segment to analyze |
end |
end time of segment to analyze |
modelset |
set of models to compare (combination of UCVM, ACVM, RCVM, RACVM, or |
spline |
whether or not to use the spline approximation for the final estimate. |
criterion |
selection criterion - either BIC or AIC (can be upper- or lowercased) |
... |
further params to |
require(smoove) # Simulate a single change point set.seed(101) ucvm1 <- simulateUCVM(T=cumsum(rexp(100)), nu=2, tau=1, method="exact") ucvm2 <- simulateUCVM(T=cumsum(rexp(100)), nu=5, tau=10, v0 = ucvm1$V[100], method="exact") T <- c(ucvm1$T, ucvm1$T[100] + ucvm2$T) Z <- c(ucvm1$Z, ucvm1$Z[100] + ucvm2$Z) plot_track(Z) # testing the true changepoint testCP(Z, T, 100, 1, 200) # both AIC and BIC are very much lower for the changepoint model # testing a changepoint in the middle of the first 100 points testCP(Z, T, 50, 1, 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.