Pcal.fun {ordgam} | R Documentation |
Compute the penalty matrix associated to a vector containing fixed (non-penalized) parameters and equal-size sub-vectors of penalized spline parameters
Description
Compute the penalty matrix associated to a vector containing fixed (non-penalized) parameters and equal-size sub-vectors of penalized 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+JK)
given by Blockdiag(diag(0,nfixed
), diag(lambda
).kron.Pd.x
)
References
Lambert, P. and Gressani, 0. (2023) Penalty parameter selection and asymmetry corrections to Laplace approximations in Bayesian P-splines models. Statistical Modelling. <doi:10.1177/1471082X231181173>. Preprint: <arXiv:2210.01668>.
Examples
Dd = diff(diag(1,5),diff=2) ## Difference penalty matrix for a vector of length 5
Pd = t(Dd) %*% Dd ## Penalty matrix of order 2
nfixed = 2 ## 2 unpenalized parameters
## Global penalty matrix when 2 unpenalized parameters and 2 additive terms with
## 2 vectors of 5 P-splines coefficients with lambda values 10 and 100 respectively.
Pcal.fun(nfixed=2,lambda=c(10,100),Pd)
[Package ordgam version 0.9.1 Index]