createS: Create a generalised penalty matrix

View source: R/functions_create.R

createSR Documentation

Create a generalised penalty matrix

Description

Create a generalised penalty matrix which can be used as hypershrinkage for co-data matrix Z.

Usage

createS(orderPen=2, G=10, categorical=FALSE)

Arguments

orderPen

The order of the difference penalty. If 0, then a ridge penalty matrix is returned.

G

Number of co-data variables to be penalised.

categorical

If TRUE, a block correlation matrix is returned.

Value

A (GxG)-dimensional penalty matrix.

References

See for an introduction on p-splines and difference penalties:

Eilers, P. H., & Marx, B. D. (2021). Practical Smoothing: The Joys of P-splines. Cambridge University Press.

See Also

A difference penalty may be applied for p-spline basis functions created with createZforSplines or for categorical co-data created with createZforGroupset.

Examples

S1 <- createS(orderPen=2,G=10) #second difference penalty matrix
S2 <- createS(orderPen=0,G=10) #zeroth order defined as ridge penalty matrix
S3 <- createS(G=10,categorical=TRUE) #difference penalty for unordered categorical groups

ecpc documentation built on May 13, 2022, 5:07 p.m.