Description STAP models Basic Use mgcv translation References See Also
Spline implimentation of Spatial Temporal Aggregated Predictors
For link function g(), outcome μ_i, i=1,...,n, STAP Models are defined by aggregating exposure to nearby built environment features (BEFs) through either measured space or time.
g(μ_i) = Z_i^T β + ∑ f(d)
g(μ_i) = Z_i^T β + ∑ f(t)
g(μ_i) = Z_i^T β + ∑ 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.
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.
A table showing the exact rsstap's mgcv counterparts are shown below:
rsstap | mgcv |
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') |
Stan Development Team (2020). RStan: the R interface to Stan. R package version 2.19.3. https://mc-stan.org
Wood, S.N. (2017) Generalized Additive Models: An Introduction with R (2nd edition).Chapman and Hall/CRC.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.