TElmem | R Documentation |
Fits a lmer
linear mixed-effects model with the random effects of
timeVar
for each level of groupingVar
. Provides estimates of time-related change
(i.e., attempts to answer the question "how different was the start than the end?").
TElmem(
formIn,
dat,
timeVar,
groupingVar,
nRuns = 5,
startingOffset = T,
silent = F
)
formIn |
model formula, as in |
dat |
model data, as in |
timeVar |
String. Indicates which variable in |
groupingVar |
String. Indicates which variable in |
nRuns |
Number of times to run optimization of the rate (i.e., fitting nonlinear transformations of |
startingOffset |
By default (if T) time is coded to start at 1 and saturate to 0. If startingOffset is F, time starts at 0 and saturates to 1. May assist in interpreting interactions with other variables, etc. |
silent |
Progress is printed by default. silent=T to suppress |
First uses TElm
to find a rate parameter for each level of groupingVar
, with
the formula extracted using tef_getRanefForm
. These
rate parameters are used to transform the corresponding timeVar
into a exponentially
saturating variable (see TElm
). After finding an initial set of
rate parameters using TElm
,
TElmem
attempts to optimize the vector of rate parameters in conjunction with the full
lmer
model.
May be used, with nRuns=0
, to simply
use rate estimates from independent groupingVar
-level TElm
models, extracting the corresponding
transformed time variables, and using them in a LMEM.
A list including:
lmerMod
lmer
model fit with transformed time variable
rates
Named vector of rates [50-percent-of-change time constants]
timeDat
Data frame with original and transformed time variable
groupMods
List of fit TElm
models, and the corresponding transformed time variable and named vector of rates
Random effects and rate estimates may be unstable, and optimization may take
a very long time to run. The primary purpose of this function is to allow for by-groupingVar
detrending of time-related changes in data (i.e., to estimate and test fixed effects at asymptotic time,
or to estimate and test the magnitude of time-related effects).
If reliable by-groupingVar
parameters are desired, especially of rate, it is highly recommended to use
TEbrm
.
The formIn
must include a random effect of timeVar
by groupingVar
(e.g., (time_variable | grouping_variable)
)
## Not run:
m_TElmem <- TElmem(acc ~ trialNum + (trialNum || subID), anstrain, timeVar = 'trialNum',groupingVar = 'subID')
# Typical lmer model:
summary(m_TElmem$lmerMod) # On average, starting accuracy was .137 worse than asymptotic accuracy
# Participant-level rate parameters:
m_TElmem$rates
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.