tensor.prod.model.matrix        package:mgcv        R Documentation

_U_t_i_l_i_t_y _f_u_n_c_t_i_o_n_s _f_o_r _c_o_n_s_t_r_u_c_t_i_n_g _t_e_n_s_o_r _p_r_o_d_u_c_t _s_m_o_o_t_h_s

_D_e_s_c_r_i_p_t_i_o_n:

     Produce model matrices or penalty matrices for a tensor product
     smooth from the model matrices or penalty matrices for the
     marginal bases of the smooth.

_U_s_a_g_e:

     tensor.prod.model.matrix(X)
     tensor.prod.penalties(S)

_A_r_g_u_m_e_n_t_s:

       X: a list of model matrices for the marginal bases of a smooth

       S: a list of penalties for the marginal bases of a smooth.

_D_e_t_a_i_l_s:

     If 'X[[1]]', 'X[[2]]' ... 'X[[m]]' are the model matrices of the
     marginal bases of  a tensor product smooth then the ith row of the
     model matrix for the whole tensor product smooth is given by
     'X[[1]][i,]%x%X[[2]][i,]%x% ... X[[m]][i,]', where '%x%' is the
     Kronecker product. Of course  the routine operates column-wise,
     not row-wise!

     If 'S[[1]]', 'S[[2]]' ... 'S[[m]]' are  the penalty matrices for
     the marginal bases, and  'I[[1]]', 'I[[2]]' ... 'I[[m]]' are
     corresponding identity matrices, each of the same  dimension as
     its corresponding penalty, then the tensor product smooth has m
     associate penalties of the form:

     'S[[1]]%x%I[[2]]%x% ... I[[m]]', 

     'I[[1]]%x%S[[2]]%x% ... I[[m]]' 

     ... 

     'I[[1]]%x%I[[2]]%x% ... S[[m]]'. 

     Of course it's important that the model matrices and penalty
     matrices are presented in the same order when  constructing tensor
     product smooths.

_V_a_l_u_e:

     Either a single model matrix for a tensor product smooth, or a
     list of penalty terms for a tensor product smooth.

_A_u_t_h_o_r(_s):

     Simon N. Wood simon.wood@r-project.org

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.maths.bath.ac.uk/~sw283/>

_S_e_e _A_l_s_o:

     'te', 'smooth.construct.tensor.smooth.spec'

_E_x_a_m_p_l_e_s:

     X <- list(matrix(1:4,2,2),matrix(5:10,2,3))
     tensor.prod.model.matrix(X)

     S<-list(matrix(c(2,1,1,2),2,2),matrix(c(2,1,0,1,2,1,0,1,2),3,3))
     tensor.prod.penalties(S)

