scanP {dpseg}R Documentation

Scan over different penalty P values

Description

Runs the dpseg recursion for different values of the penalty parameter P and returns a matrix with the used P values, the resulting number of segments and (optionally) the median of segment variance of residuals.

Usage

scanP(x, y, P, var = TRUE, use.matrix = TRUE, plot = TRUE,
  verb = 1, ...)

Arguments

x

x-values

y

y-values

P

vector of penalties P to scan

var

add the median of the variances of residuals of all segments to output (save time by var=FALSE)

use.matrix

use the stored scoring function matrix for more efficient scans; set this to FALSE if you run into memory problems

plot

plot results

verb

print progress messages

...

parameters for dpseg (except P)

Value

Returns a matrix with the penalties P in the first column, the number of segments in the second column and the median of variances in the third column.

Examples

x <- oddata$Time
y <- log(oddata$A5)
par(mai=c(par("mai")[1:3], par("mai")[2])) # to show right axis
sp <- scanP(x=x, y=y, P=seq(-.01,.1,length.out=50), plot=TRUE)

[Package dpseg version 0.1.1 Index]