The mixed design functions are extremely basic. I plan to work on more useful functions, but this paper provides a tutorial and examples for more complex designs.
This function produces a data table for a basic cross-classified design with random intercepts for subjects and items.
For example, the following code produces the data for 100 subjects responding to 50 items where the response has an overall mean (
grand_i) of 10. Subjects vary in their average response with an SD of 1, items vary in their average response with an SD of 2, and the residual error term has an SD of 3.
You can then see how changing these numbers affects the random effects in an intercept-only mixed effects model.
For example, changing
grand_i to 0 changes the estimate for the fixed effect of the intercept
sub_sd to 1.5 and
item_sd to 3 change the estimate for the SD of their corresponding random effects. Changing
error_sd to 10 changes the estimate from the Residual SD.
This function uses
lme4::lmer() to get subject, item and error SDs from an existing dataset and simulates a new dataset with the specified number of subjects and items with distributions drawn from the example data.
This example uses the
fr4 dataset from this package to simulate 100 new subjects viewing 50 new faces.