whit2: Weighted Whittaker smoothing with a second order finite...

Description Usage Arguments Value Author(s) References Examples

View source: R/smooth_wWHIT.R

Description

This function smoothes signals with a finite difference penalty of order 2. This function is modified from ptw package.

Usage

1
whit2(y, lambda, w = rep(1, ny))

Arguments

y

signal to be smoothed: a vector

lambda

smoothing parameter: larger values lead to more smoothing

w

weights: a vector of same length as y. Default weights are equal to one

Value

A numeric vector, smoothed signal.

Author(s)

Paul Eilers, Jan Gerretzen

References

  1. Eilers, P.H.C. (2004) "Parametric Time Warping", Analytical Chemistry, 76 (2), 404 – 411.

  2. Eilers, P.H.C. (2003) "A perfect smoother", Analytical Chemistry, 75, 3631 – 3636.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(phenofit)
data("MOD13A1")
dt <- tidy_MOD13.gee(MOD13A1$dt)
y <- dt[site == "AT-Neu", ][1:120, y]

plot(y, type = "b")
lines(whit2(y, lambda = 2), col = 2)
lines(whit2(y, lambda = 10), col = 3)
lines(whit2(y, lambda = 100), col = 4)
legend("bottomleft", paste("lambda = ", c(2, 10, 15)), col = 2:4, lty = rep(1, 3))

phenofit documentation built on April 2, 2020, 5:07 p.m.