residuals {cpop} | R Documentation |
Extract residuals from a cpop model
Description
Extracts residuals from a cpop model.
Usage
## S4 method for signature 'cpop.class'
residuals(object)
Arguments
object |
An instance of an S4 class produced by |
Value
A single column matrix containing the residuals.
References
Fearnhead P, Grose D (2024). “cpop: Detecting Changes in Piecewise-Linear Signals.” Journal of Statistical Software, 109(7), 1–30. doi:10.18637/jss.v109.i07.
Examples
library(cpop)
# simulate data with change in gradient
set.seed(1)
x <- (1:50/5)^2
y <- simchangeslope(x,changepoints=c(10,50),change.slope=c(0.25,-0.25),sd=1)
# determine changepoints
res <- cpop(y,x,beta=2*log(length(y)))
# calculate the residuals
residuals(res)
[Package cpop version 1.0.7 Index]