# mgcv GAM - is it possible to include the 'simple' product of two 1-d smooths?

I am trying to test out various mgcv::gam models in a scalar-on-function regression analysis.

The following is the 'hierarchy' of models I would like to test: $$Y_i = \alpha + \int_0^TX_i(t)\beta(t) dt \tag{1}$$

$$Y_i = \alpha + \int_0^TF(X_i(t))\beta(t) dt \tag{2}$$

$$Y_i = \alpha + \int_0^TF(X_i(t),t) dt \tag{3}$$

where $Y_i$ are scalar outcomes for the $i$th subject, and $X_i(t)$ is a functional covariate observed at times $t\in[0,1,...T]$. Intuitively, model 1 is a linear functional model with a (potentially non-linear) time-dependent regression coefficient for the covariate. Model 2 allows for a non-linear weight function for the covariate, but which is constant over time. Model 3 is the full 'functional GAM' that allows for a fully flexible non-linear covariate- and time- dependent function. In my mind at least these form a natural step-by-step approach to testing this type of regression model.

Models 1 (linear functional) and 3 (functional GAM) are relatively straightforward to do with matrix arguments to mgcv::gam. Assume $N$ subjects observed at $T$ time points. Y is the length $N$ vector of scalar outcomes and X,T, W are the $N\times T$ matrices of the functional predictor data values, their observation times, and trapezoidal quadrature weights, respectively.

Models (1) and (3) could be obtained with:

m1 = gam(Y ~ s(T, by=I(X*W), bs='ps')
m3 = gam(Y ~ te(X, T, by=W), bs='ps')


However, I cannot find a way to achieve model (2)? Effectively what I need (I think) is a way of creating a te() tensor product smooth but somehow constraining each marginal smooth to be the same for all values of the other variable? Is this possible?