View source: R/time_basisFun_formula.R
time_basisFun_formula | R Documentation |
Adds basis functions, over the dimension of time, to a conventional [generalized] linear mixed-effects model formula.
time_basisFun_formula(
formula_mem,
...,
groupingVar,
timeVar,
basisDens,
basis_calc_fun = "gaussian"
)
formula_mem |
Formula, specified as in |
... |
|
groupingVar |
Character. Grouping variable for each timecourse (e.g., participant ID, or combination of participant and session) |
timeVar |
Numeric vector. Variable over which basis functions are to be constructed. |
basisDens |
Numeric scalar. Width between basis functions peaks (e.g., distance between first and second basis function highest-density points) |
basis_calc_fun |
Character. Function by which the basis functions are constructed. Currently only "gaussian" is implemented. |
Within a typical [G]LMEM, adding basis functions over the dimension
of time can control for time-related variations, while also allowing
for the recovery of those variations. This function takes in the
formula of interest (e.g., y ~ x + (x|ID)
) and its associated
time data, and it returns an augmented formula
(e.g., y ~ x + (x|ID) + (0 + basis_0 + basis_1 + basis_2 + basis_3 || ID)
).
The corresponding data (i.e., constructed bases) are included as an attribute of the
returned formula (i.e., returnedFormula,'dfOut'
).
This function is designed to be compatible with lme4
and
brms
models.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.