Spline implimentation of Spatial Temporal Aggregated Predictors

STAP models

For link function \(g()\), outcome \(\mu_i\), \(i=1,...,n\), STAP Models are defined by aggregating exposure to nearby built environment features (BEFs) through either measured space or time.

$$ g(\mu_i) = Z_i^T \beta + \sum f(d) $$

$$ g(\mu_i) = Z_i^T \beta + \sum f(t) $$

$$ g(\mu_i) = Z_i^T \beta + \sum f(d,t) $$

Incorporating these models into a standard regression framework is accomplished in this package via a generalized additive approach, using aggregated smooth terms via the jagam function.

Basic Use

Inspired by the mgcv package, rsstap incorporates STAP terms in the model via the use of a coded term in the standard model formula. For example to fit a model with continuous outcome BMI, covariate sex, and include distances to FFR as a measure of spatial exposure (not temporal) one would use the following model formula in (say) the sstap_lm function:

sstap_lm(BMI ~ sex + sap(FFR),benvo = FFR_benvo).

If aggregating (only) temporal exposure one would use the keyword tap and if both space and time are measured, one could use the keyword stap. The dimension of the basis function expansion can be set familiarly, as a possible option: sap(FFR, k = 5). For now the choice of splines is fixed within this package to be penalized b-splines. This may change in the future.

Note that these terms are parsed using regex style functions and so care must be taken not to misspell terms. Any use outside of what is defined here will likely result in erroneous behavior.

mgcv translation

A table showing the exact rsstap's mgcv counterparts are shown below:

rsstapmgcv
sap(foo,k=1)s(Distance,k=1,bs='ps')
sap(foo)s(Distance,bs='ps')
tap(foo)s(Time,bs='ps')
stap(foo)t2(Distance,Time,bs='ps')

References

  1. Stan Development Team (2020). RStan: the R interface to Stan. R package version 2.19.3. https://mc-stan.org

  2. Wood, S.N. (2017) Generalized Additive Models: An Introduction with R (2nd edition).Chapman and Hall/CRC.

See also