EVOLUTION-MANAGER
Edit File: tensor.prod.model.matrix.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Utility functions for constructing tensor product smooths</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for tensor.prod.model.matrix {mgcv}"><tr><td>tensor.prod.model.matrix {mgcv}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Utility functions for constructing tensor product smooths</h2> <h3>Description</h3> <p>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. </p> <h3>Usage</h3> <pre> tensor.prod.model.matrix(X) tensor.prod.penalties(S) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>X</code></td> <td> <p>a list of model matrices for the marginal bases of a smooth</p> </td></tr> <tr valign="top"><td><code>S</code></td> <td> <p>a list of penalties for the marginal bases of a smooth.</p> </td></tr> </table> <h3>Details</h3> <p> If <code>X[[1]]</code>, <code>X[[2]]</code> ... <code>X[[m]]</code> 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 <code>X[[1]][i,]%x%X[[2]][i,]%x% ... X[[m]][i,]</code>, where <code>%x%</code> is the Kronecker product. Of course the routine operates column-wise, not row-wise! </p> <p>If <code>S[[1]]</code>, <code>S[[2]]</code> ... <code>S[[m]]</code> are the penalty matrices for the marginal bases, and <code>I[[1]]</code>, <code>I[[2]]</code> ... <code>I[[m]]</code> 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: </p> <p><code>S[[1]]%x%I[[2]]%x% ... I[[m]]</code>, </p> <p><code>I[[1]]%x%S[[2]]%x% ... I[[m]]</code> </p> <p>... </p> <p><code>I[[1]]%x%I[[2]]%x% ... S[[m]]</code>. </p> <p>Of course it's important that the model matrices and penalty matrices are presented in the same order when constructing tensor product smooths. </p> <h3>Value</h3> <p> Either a single model matrix for a tensor product smooth, or a list of penalty terms for a tensor product smooth. </p> <h3>Author(s)</h3> <p> Simon N. Wood <a href="mailto:simon.wood@r-project.org">simon.wood@r-project.org</a></p> <h3>References</h3> <p>Wood, S.N. (2006) Low rank scale invariant tensor product smooths for Generalized Additive Mixed Models. Biometrics 62(4):1025-1036 </p> <h3>See Also</h3> <p><code><a href="te.html">te</a></code>, <code><a href="smooth.construct.tensor.smooth.spec.html">smooth.construct.tensor.smooth.spec</a></code> </p> <h3>Examples</h3> <pre> require(mgcv) 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) </pre> <hr /><div style="text-align: center;">[Package <em>mgcv</em> version 1.8-28 <a href="00Index.html">Index</a>]</div> </body></html>