Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

P.penalty

Penalty matrix for higher order differences


Description

This function computes the matrix that penalizes the higher order differences.

Usage

P.penalty(tt, P = c(0, 0, 1))

Arguments

tt

vector of the n discretization points or argvals.

P

vector of coefficients with the order of the differences. Default value P=c(0,0,1) penalizes the second order difference.

Details

For example, if P=c(0,1,2), the function return the penalty matrix the second order difference of a vector tt. That is

v^T P_j tt= ∑_{i=3} ^{n} (Δ tt_i) ^2

where

Δ tt_i= tt_i -2 tt_{i-1} + tt_{i-2}

is the second order difference. More details can be found in Kraemer, Boulesteix, and Tutz (2008).

Value

penalty matrix of size sum(n) x sum(n)

Note

The discretization points can be equidistant or not.

Author(s)

This version is created by Manuel Oviedo de la Fuente modified the original version created by Nicole Kramer in ppls package.

References

N. Kraemer, A.-L. Boulsteix, and G. Tutz (2008). Penalized Partial Least Squares with Applications to B-Spline Transformations and Functional Data. Chemometrics and Intelligent Laboratory Systems, 94, 60 - 69. http://dx.doi.org/10.1016/j.chemolab.2008.06.009

See Also

Examples

P.penalty((1:10)/10,P=c(0,0,1))
# a more detailed example can be found under script file

fda.usc

Functional Data Analysis and Utilities for Statistical Computing

v2.0.2
GPL-2
Authors
Manuel Febrero Bande [aut], Manuel Oviedo de la Fuente [aut, cre], Pedro Galeano [ctb], Alicia Nieto [ctb], Eduardo Garcia-Portugues [ctb]
Initial release
2020-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.