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

1 | ```
Penalty.matrix(m,order = 2)
``` |

`m` |
vector. The |

`order` |
order of the differences. Default value is |

For the jth entry of the vector `m`

, and for the default values `order`

=2, the penalty matrix *P_j* penalizes the second order
differences of a vector *v* of length m[j]. That is

*v^T P_j v= ∑_{i=3} ^{m[j]} (Δ v_i) ^2*

where

*Δ v_i= v_i -2 v_{i-1} + v_{i-2}*

is the second order difference. This definition is easily extended to
other values of `order`

. The final penalty matrix `P`

is a
block-diagonal matrix with the jth block equal to *P_j*. More
details can be found in Kraemer, Boulesteix, and Tutz (2008).

penalty matrix of size `sum(m)`

x `sum(m)`

All entries of the vector `m`

must be larger than
`order`

, as the notion of kth order differences does not make
sense for vectors of length *≤* k.

Nicole Kraemer

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

C. de Boor (1978) *A Practical Guide to Splines*, Springer.

1 2 | ```
P<-Penalty.matrix(c(6,4),2)
# a more detailed example can be found under penalized.pls()
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.