Description Usage Arguments Details Value
View source: R/practice_effects.R
Simulates psychological response time data containing a practice
effect, such that the response time decays exponentially at a rate
determined by learning_rate
until reaching
asymptote
. Units are milliseconds.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | sim_practice(
n_subj,
n_trials,
within_eff = 10,
between_eff = 24,
asymptote = 400,
sweep = 400,
learning_rate = -2,
rslope_sd = 20,
rasym_sd = 40,
rsweep_sd = 40,
rlrate_sd = 0,
err_sd = 20,
verbose = FALSE
)
|
n_subj |
Number of subjects. |
n_trials |
Number of trials per subject. |
within_eff |
Mean effect of within-subject factor, coded by
|
between_eff |
Mean effect of between-subject factor, coded by
|
asymptote |
Asymptotic value. |
sweep |
The 'sweep' of the decline; i.e., the distance from the asymptote to the starting value. |
learning_rate |
Speed of the decay. |
rslope_sd |
By-subject standard deviation for the random slope. |
rasym_sd |
By-subject standard deviation for the random asymptote. |
rsweep_sd |
By-subject standard deviation for the random sweep. |
rlrate_sd |
By-subject standard deviation for the learning rate. |
err_sd |
Error standard deviation. |
verbose |
Whether to return random effects in the data frame. |
The data contains main effects of the within-subject and
between-subject factors, but no interaction. The model also
contains four by-subject random effects (within-subject slope,
asymptote, sweep, and learning rate). These random effects are
all independent from one another. The data-generating model for
response y
for subject i
and observation j is:
yij ~ (g00 + S0i) * wij + g10 + S1i + g11 * bi +
(g20 + S2i) * exp(-exp(g30 + S3i) * tij) + eij
where the predictors are:
g00
mean within-subject effect;
S0i
by-subject random slope;
wij
deviation-coded predictor for the within-subject effect;
g10
mean asymptote;
S1i
random asymptote for subject i
;
g11
mean between-subject effect;
bi
deviation-coded predictor for the between-subject effect;
g20
mean sweep (distance from starting value to asymptote);
S2i
random sweep for subject i
;
g30
mean learning rate;
S3i
random learning rate for subject i
;
tij
trial number for subject i
, observation j
;
eij
random error for subject i
, observation j
.
A data frame with some or all of the following fields,
depending on the value of verbose
:
subj_id
Unique subject identifier.
tij
Trial number.
wij
Deviation-coded within-subject predictor.
bi
Deviation-coded between-subject predictor.
y
The response value.
S0i
By-subject random slope.
S1i
By-subject random asymptote.
S2i
By-subject random sweep.
S3i
By-subject random learning rate.
trueval
Response value excluding the within-subject effect/random slope.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.