`"fastcpd_mean"`

and `"fastcpd.mean"`

are wrapper
functions of `fastcpd`

to find the mean 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.

## Arguments

- data
A matrix, a data frame or a vector.

- ...
Other arguments passed to

`fastcpd`

, for example,`segment_count`

.

## Examples

```
if (!requireNamespace("mvtnorm", quietly = TRUE)) utils::install.packages(
"mvtnorm", repos = "https://cloud.r-project.org", quiet = TRUE
)
set.seed(1)
p <- 3
data <- rbind(
mvtnorm::rmvnorm(300, mean = rep(0, p), sigma = diag(100, p)),
mvtnorm::rmvnorm(400, mean = rep(50, p), sigma = diag(100, p)),
mvtnorm::rmvnorm(300, mean = rep(2, p), sigma = diag(100, p))
)
result <- fastcpd.mean(data)
summary(result)
#>
#> Call:
#> fastcpd.mean(data = data)
#>
#> Change points:
#> 300 700
#>
#> Cost values:
#> 3388.157 4523.582 3381.572
# Test `fastcpd.mean()` running time. The running time is expected to be less
# than 1.5 seconds.
set.seed(1)
data <- c(rnorm(10000), rnorm(1000) + 1)
(result_time <- system.time(
result <- fastcpd.mean(data, r.progress = FALSE, cp_only = TRUE)
))
#> user system elapsed
#> 0.701 0.000 0.701
result@cp_set
#> [1] 10006
```