simulate_mixtur: Generate simulated data from mixture models

View source: R/simulating.R

simulate_mixturR Documentation

Generate simulated data from mixture models

Description

Generate simulated data from mixture models

Usage

simulate_mixtur(n_trials, model, kappa, p_u, p_n, K, set_size)

Arguments

n_trials

an integer indicating how many trials to simulate

model

a string indicating the model to be fit to the data. Currently the options are "2_component", "3_component", "slots", and "slots_averaging".

kappa

a numeric value indicating the concentration parameter of the von Mises distribution to use in the simulations. Note, when simulating from the 2_component or 3_component model, if multiple values are provided to the set_size argument, kappa must be a vector of parameter values to use for each set size).

p_u

a numeric value indicating the probability of uniform guessing to use when simulating from the 2_component and 3_component models. Note, when simulating from the 2_component or 3_component model, if multiple values are provided to the set_size argument, p_u must be a vector of parameter values to use for each set size).

p_n

a numeric value indicating the probability of a non-target response when simulating from the 3_component model. Note, when simulating from the 2_component or 3_component model, if multiple values are provided to the set_size argument, p_n must be a vector of parameter values to use for each set size).

K

a numeric value indicating the capacity value to use when simulating from the slots and slots_averaging models.

set_size

a numeric value (or vector) indicating the set size(s) to use in the simulations

Value

Returns a data frame containing simulated responses from the requested model per set-size (if applicable).

Examples


# simulate from the slots model

slots_data <- simulate_mixtur(n_trials = 1000,
                             model = "slots",
                             kappa = 8.2,
                             K = 2.5,
                             set_size = c(2, 4, 6, 8))


# simulate one set size from the 3_component model

component_data <- simulate_mixtur(n_trials = 1000,
                                 model = "3_component",
                                 kappa = 8.2,
                                 p_u = .1,
                                 p_n = .15,
                                 set_size = 4)


# simulate multiple set sizes from the 3_component model

component_data_multiple_sets <- simulate_mixtur(n_trials = 1000,
                                               model = "3_component",
                                               kappa = c(10, 8, 6),
                                               p_u = c(.1, .1, .1),
                                               p_n = c(.1, .15, .2),
                                               set_size = c(2, 4, 6))


mixtur documentation built on April 6, 2023, 5:19 p.m.