Pcal.fun {DALSM} | R Documentation |
Generation of the penalty matrix for an additive model based on P-splines
Description
Compute the penalty matrix associated to a vector containing fixed (non-penalized) parameters and equal-size sub-vectors of penalized B-spline parameters.
Usage
Pcal.fun(nfixed, lambda, Pd.x)
Arguments
nfixed |
the number of fixed (i.e. non-penalized) parameters. |
lambda |
a vector of |
Pd.x |
a penalty matrix of size |
Value
A block diagonal penalty matrix of size (nfixed+pJ)
given by Blockdiag(diag(0,nfixed
), diag(lambda
).kron.Pd.x
).
Author(s)
Philippe Lambert p.lambert@uliege.be
References
Lambert, P. (2021). Fast Bayesian inference using Laplace approximations in nonparametric double additive location-scale models with right- and interval-censored data. Computational Statistics and Data Analysis, 161: 107250. <doi:10.1016/j.csda.2021.107250>
Examples
D = diff(diag(5),diff=2) ## Difference penalty matrix of order 2 for 5 P-spline parameters
P = t(D) %*% D ## Penalty matrix of order 2 for 5 B-spline parameters
lambda = c(100,10) ## Penalty parameters for 2 additive terms with 5 B-spline parameters each
Pcal.fun(3,lambda,P) ## Global penalty matrix for 3 additional non-penalized parameters