estimateP: Estimate a starting value for penalty P.

Description Usage Arguments Value Examples

View source: R/scans.R

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

1
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

1
2
3
4
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)))

dpseg documentation built on Aug. 17, 2020, 5:06 p.m.