fitted {cpop}R Documentation

Extract model fitted values

Description

Extracts the fitted values produced by cpop.

Usage

## S4 method for signature 'cpop.class'
fitted(object)

Arguments

object

An instance of an S4 class produced by cpop.

Value

A data frame containing the endpoint coordinates for each line segment fitted between the detected changepoints. The data frame also contains the gradient and intercept values for each segment and the corresponding residual sum of squares (RSS).

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 segments
fitted(res)

[Package cpop version 1.0.6 Index]