View source: R/functions_create.R
createS | R Documentation |
Create a generalised penalty matrix which can be used as hypershrinkage for co-data matrix Z.
createS(orderPen=2, G=10, categorical=FALSE)
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. |
A (GxG)-dimensional penalty matrix.
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.
A difference penalty may be applied for p-spline basis functions created with createZforSplines
or for categorical co-data created with createZforGroupset
.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.