fastcpd_meanvariance {fastcpd} | R Documentation |
Find change points efficiently in mean variance change models
Description
fastcpd_meanvariance()
, fastcpd.meanvariance()
,
fastcpd_mv()
, fastcpd.mv()
are wrapper
functions of fastcpd()
to find the meanvariance change. The
function is similar to fastcpd()
except that the data is by
default a matrix or data frame or a vector with each row / element as an
observation and thus a formula is not required here.
Usage
fastcpd_meanvariance(data, ...)
fastcpd.meanvariance(data, ...)
fastcpd_mv(data, ...)
fastcpd.mv(data, ...)
Arguments
data |
A matrix, a data frame or a vector. |
... |
Other arguments passed to |
Value
A fastcpd object.
See Also
Examples
if (requireNamespace("mvtnorm", quietly = TRUE)) {
set.seed(1)
p <- 1
result <- fastcpd.mv(
rbind(
mvtnorm::rmvnorm(300, mean = rep(0, p), sigma = diag(1, p)),
mvtnorm::rmvnorm(400, mean = rep(10, p), sigma = diag(1, p)),
mvtnorm::rmvnorm(300, mean = rep(0, p), sigma = diag(100, p)),
mvtnorm::rmvnorm(300, mean = rep(0, p), sigma = diag(1, p)),
mvtnorm::rmvnorm(400, mean = rep(10, p), sigma = diag(1, p)),
mvtnorm::rmvnorm(300, mean = rep(10, p), sigma = diag(100, p))
)
)
summary(result)
plot(result)
}
if (requireNamespace("mvtnorm", quietly = TRUE)) {
set.seed(1)
p <- 4
result <- fastcpd.mv(
rbind(
mvtnorm::rmvnorm(300, mean = rep(0, p), sigma = diag(1, p)),
mvtnorm::rmvnorm(400, mean = rep(10, p), sigma = diag(1, p)),
mvtnorm::rmvnorm(300, mean = rep(0, p), sigma = diag(100, p)),
mvtnorm::rmvnorm(300, mean = rep(0, p), sigma = diag(1, p)),
mvtnorm::rmvnorm(400, mean = rep(10, p), sigma = diag(1, p)),
mvtnorm::rmvnorm(300, mean = rep(10, p), sigma = diag(100, p))
)
)
summary(result)
}
set.seed(1)
data <- c(rnorm(2000, 0, 1), rnorm(2000, 1, 1), rnorm(2000, 1, 2))
(result_time <- system.time(
result <- fastcpd.variance(data, r.progress = FALSE, cp_only = TRUE)
))
result@cp_set
set.seed(1)
data <- c(rnorm(2000, 0, 1), rnorm(2000, 1, 1), rnorm(2000, 1, 2))
(result_time <- system.time(
result <- fastcpd.variance(
data, beta = "BIC", cost_adjustment = "BIC",
r.progress = TRUE, cp_only = TRUE
)
))
result@cp_set
[Package fastcpd version 0.14.3 Index]