estimateP {dpseg}R Documentation

Estimate a starting value for penalty P.

Description

The break-point penalty P in a dpseg recursion, should be in the range of expected values of the scoring function. To find a good initial estimate for P when using the default scoring fuction (see dpseg), the data is smoothed by smooth.spline and the variance of residuals reported.

Usage

estimateP(x, y, plot = FALSE, ...)

Arguments

x

x-values

y

y-values

plot

plot the smooth.spline

...

parameters for smooth.spline

Value

Returns a double, variance of residuals of a spline fit (var(smooth.spline(x,y, ...)$y -y))

Examples

x <- oddata$Time
y <- log(oddata$A5)
p <- estimateP(x=x, y=y, plot=TRUE)
plot(dpseg(x=x, y=y, jumps=TRUE, P=round(p,3)))

[Package dpseg version 0.1.1 Index]