sim_goals | R Documentation |
For each subject, simulate a specified number of goals. There are three
options for defining the number of goals: n_goals
sets the same number
for each subject, n_goals_range
sets the minimum and maximum number,
and n_goals_prob
sets specific probabilities for each number.
sim_goals( subjects, n_goals = NULL, n_goals_range = NULL, n_goals_prob = NULL, sigma_e = 0.5 )
subjects |
A data frame with a row per subject. |
n_goals |
The exact number of goals for each subject. |
n_goals_range |
A vector defining the minimum and maximum number of goals per subjects. Randomly samples the range of goals with uniform probability. |
n_goals_prob |
A named list with element |
sigma_e |
Standard deviation of the goal-level random effect, i.e. the random error of each latent goal score. |
The same subjects
data frame with a n_goals
column, and
goals
list column. The goals
list column contains tibbles with two
variables: a subject-specific goal index goal_num
, and a normally
distributed random effect goal_re
.
sim_subjects() %>% sim_goals(n_goals = 3, sigma_e = 0.8) sim_subjects() %>% sim_goals(n_goals_range = c(2, 7)) sim_subjects() %>% sim_goals(n_goals_prob = list(n_goals = c(6, 3, 4), prob = c(0.3, 0.5, 0.2)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.