fastcpd_poisson {fastcpd} | R Documentation |
Find change points efficiently in Poisson regression models
Description
fastcpd_poisson()
and fastcpd.poisson()
are
wrapper functions of fastcpd()
to find change points in
Poisson regression models. The function is similar to fastcpd()
except that the data is by default a matrix or data frame with the response
variable as the first column and thus a formula is not required here.
Usage
fastcpd_poisson(data, ...)
fastcpd.poisson(data, ...)
Arguments
data |
A matrix or a data frame with the response variable as the first column. |
... |
Other arguments passed to |
Value
A fastcpd object.
See Also
Examples
if (requireNamespace("mvtnorm", quietly = TRUE)) {
set.seed(1)
n <- 1100
p <- 3
x <- mvtnorm::rmvnorm(n, rep(0, p), diag(p))
delta <- rnorm(p)
theta_0 <- c(1, 0.3, -1)
y <- c(
rpois(500, exp(x[1:500, ] %*% theta_0)),
rpois(300, exp(x[501:800, ] %*% (theta_0 + delta))),
rpois(200, exp(x[801:1000, ] %*% theta_0)),
rpois(100, exp(x[1001:1100, ] %*% (theta_0 - delta)))
)
result <- fastcpd.poisson(cbind(y, x))
summary(result)
plot(result)
}
[Package fastcpd version 0.14.3 Index]