Learn R Programming

cpop (version 1.0.8)

estimate: Estimate the fit of a cpop model

Description

Estimates the fit of a cpop model at the specified locations. If no locations are specified it evaluates the estimates at the locations specified when calling cpop.

Value

A data frame with two columns containing the locations x and the corresponding estimates y_hat.

Arguments

object

An instance of an S4 class produced by cpop.

x

Locations at which the fit is to be estimated. Default value is the x locations at which the cpop object was defined.

...

Additional arguments.

References

cpop-jss-article-2024cpop

Examples

Run this code
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)))

# estimate fit at points used in call to cpop
estimate(res)

# estimate fit at specified locations
estimate(res,seq(0,100,10))

#extrapolate fit
estimate(res,seq(-20,140,20))

Run the code above in your browser using DataLab