Fpop_w: Fpop_w

View source: R/fpaccess.R

Fpop_wR Documentation

Fpop_w

Description

Function to run the Fpop algorithm (Maidstone et al. 2016) with weights. It uses functional pruning and optimal partionning. It optimizes the weighted L2-loss (w_i (x_i - μ)2) for a penalty lambda per change.

Usage

Fpop_w(x, w, lambda, mini = min(x), maxi = max(x))

Arguments

x

a numerical vector to segment.

w

a numerical vector of weights (values should be larger than 0).

lambda

the penalty per changepoint (see Maidstone et al. 2016).

mini

minimum mean segment value to consider in the optimisation.

maxi

maximum mean segment value to consider in the optimisation.

Value

return a list with a vector t.est containing the position of the change-points, the number of changes K and, the cost J.est.

Examples

x <- c(rnorm(100), rnorm(10^3)+2, rnorm(1000)+1)
est.sd <- sdDiff(x) ## rough estimate of std-deviation
res <- Fpop_w(x=x, w=rep(1, length(x)), lambda=2*est.sd^2*log(length(x)))
smt <- getSMT(res)

fpopw documentation built on June 7, 2022, 1:09 a.m.

Related to Fpop_w in fpopw...