0
$\begingroup$

Does anyone have any insights on how to perform signal regression when the smooth predictor has more than one dimension? The single dimension setting,

b <- gam(y ~ s(X,by=L,k=20),

is covered in depth in mgcv documentation (https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/linear.functional.terms.html). I am having trouble identifying what the equivalent would look like for a two-dimensional predictor using a tensor basis, e.g.

b <- gam(y ~ te(X, Y, by = L, k = c(20, 20)).

More specifically, what would the dimensions of X and Y be? Would L contain the vectorized two-dimensional predictors in the spirit of the one-dimensional example?

Thanks in advance.

$\endgroup$
0
$\begingroup$

I gave up trying to work out the smooth using SmoothCon() which was giving me errors. The solution is simply to vectorize and extend the model matrices used for a one-dimensional signal regression described in the original question above. Say you have outcomes $z_i$ for $i = 1, \ldots, n$ and your functional predictor is $f(x_i, y_i)$ where $x_i = \{x_{ij}\}_{j = 1, \ldots, J}$ and $y_i = \{y_{ik}\}_{k = 1, \ldots, K}$. Let $X = [1_K \otimes x_1, \ldots, 1_K \otimes x_n]$, $Y = [y_1 \otimes 1_J, \ldots, y_n \otimes 1_J]$, and $L = [\text{vec}\{f(x_1, y_1)\}, \ldots, \text{vec}\{f(x_n, y_n)\}]$, then the appropriate signal regression model for a two-dimensional functional predictor can be fit using the command,

b <- gam(z ~ te(X, Y, by = L, k = c(20, 20))).
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.