Description Usage Arguments Details NLME LMEM GAMM
Fit Models to Simulated Practice Data
1 2 3 4 5 | fit_practice_nlme(dat, start_vals = c(10, 400, 24, 400, -2))
fit_practice_gamm(dat)
fit_practice_lmem(dat)
|
dat |
Data frame, the result of |
start |
Vector of five starting values for
|
fit_practice_nlme
fits a Non-Linear Mixed-Effects
(NLME) model using nlme
;
fit_practice_gamm
fits a Generalized Additive
Mixed-Effects Model (GAMM) using bam
with a
by-subject factor smooth for trial; fit_practice_lmem
fits
a Linear Mixed-Effects Model (LMEM) also using
bam
for comparability to the GAMM, but as it
includes no wiggly terms, it is functionally equivalent to a
model fit using the lme4
package. For simplicity, all
models assume a constant learning rate across subjects.
The exact models are:
nlme::nlme(y ~ b0 * wij + Asym + sweep * exp(-exp(lrc) * tij),
groups = ~ subj_id,
dat, fixed = list(b0 ~ 1, Asym ~ bi, sweep ~ 1, lrc ~ 1),
random = nlme::pdDiag(b0 + Asym + sweep ~ 1),
start = start_vals)
mgcv::bam(y ~ wij + bi +
s(subj_id, bs = "re") + # random intercept
s(wij, subj_id, bs = "re"), # random slope
data = dat)
mgcv::bam(y ~ wij + bi +
s(tij, bs = "tp") + # common smooth
s(wij, subj_id, bs = "re") + # random slope
s(tij, subj_id, bs = "fs"), # factor smooth (time-varying icept)
data = dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.