The function simulates data from a typical psychophysics experiment using a 2-alternative forced choice task and the method of constant stimuli. For each simulated participant, the function returns the following information: individual slope and intercept coefficients, based on the fixed and random effects parameters provided as input; summary of the simulated binomial response across a range of intensity levels within a specified stimulus range; individual lapse and guess rates, if applicable.
fixeff: Numeric array of fixed effects. The first item is the intercept, the second element is the slope.
raneff: Numeric array of random effects. The first element is the intercept, the second is the covariance, the third is the slope variance.
nsubjects: Integer. Number of subjects to simulate. Default is 8.
ntrials: Integer. Number of trials for each stimulus level. Default is 40.
nintervals: Integer. Number of stimulus levels. Default is 9.
xint: Numeric array specifying the range of stimulus intensity. Default is c(40,120)
constant: Logical. If TRUE (defualt), stimulus levels are evenly spaced across xint. If FALSE, stimulus levels are randomly generated within the interval.
lapse: Logical or numeric. If FALSE (default), no lapse rate is applied. If TRUE, a random lapse rate is drawn from lapse_range. If a numeric value is provided, all subjects will have the same lapse rate.
guess: Logical or numeric. If FALSE (default), no guessing rate is applied. If TRUE, a random guessing rate is drawn from guess_range. If a numeric value is provided, all subjects will have the same guess rate.
lapse_range: Numeric array defining the minimum and maximum lapse rates when lapse = TRUE. Default is c(0, 0.05).
guess_range: Numeric array defining the minimum and maximum guessing rates when guess = TRUE. Default is c(0.05, 0.10).
Returns
A data frame containing simulated psychophysical data with the following columns:
Subject - Subject identifier.
X - Stimulus intensity levels.
Intercept - Individual intercept values.
Slope - Individual slope values.
Gamma (optional) - Guess rate, included if guess is not FALSE.
Lambda (optional) - Lapse rate, included if lapse is not FALSE.
Longer - Number of "Longer" responses at each stimulus level.
Total - Total number of trials per stimulus level.