Learn R Programming

survPen (version 2.0.1)

tensor.prod.S: Tensor product for penalty matrices

Description

Computes the penalty matrices of a tensor product smooth from the marginal penalty matrices. The code is from function tensor.prod.penalties in mgcv package.

Usage

tensor.prod.S(S)

Value

TS

List of the penalty matrices associated with the tensor product smooth

Arguments

S

list of m marginal penalty matrices

Examples

Run this code

library(survPen)

# tensor product between three penalty matrices
set.seed(15)

S1 <- matrix(rnorm(3*3),nrow=3,ncol=3)
S2 <- matrix(rnorm(2*2),nrow=2,ncol=2)

S1 <- 0.5*(S1 + t(S1) ) ; S2 <- 0.5*(S2 + t(S2) )

tensor.prod.S(list(S1,S2))

Run the code above in your browser using DataLab