Pcal.fun | R Documentation |
Compute the penalty matrix associated to a vector containing fixed (non-penalized) parameters and equal-size sub-vectors of penalized spline parameters.
Pcal.fun(nfixed, lambda, Pd.x)
nfixed |
the number of fixed (i.e. non-penalized) parameters. |
lambda |
a vector of |
Pd.x |
a penalty matrix of size |
A block diagonal penalty matrix of size (nfixed+pJ)
given by Blockdiag(diag(0,nfixed
), diag(lambda
).kron.Pd.x
).
Philippe Lambert p.lambert@uliege.be
Lambert, P. and Kreyenfeld, M. (2025). Time-varying exogenous covariates with frequently changing values in double additive cure survival model: an application to fertility. Journal of the Royal Statistical Society, Series A. <doi:10.1093/jrsssa/qnaf035>
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.