| simData | R Documentation | 
Simulate data from a given density function via multinomial sampling
simData(
  n,
  pars,
  tt,
  pdfND,
  fun.density = Voss.density,
  args.density = list(prec = 3),
  npars = 5,
  return.pdf = FALSE,
  normalizePdfs = TRUE
)
n | 
 Number of observations to be sampled  | 
pars | 
 Parameter values for the density function to be evaluated with.   | 
tt | 
 time grid on which the density function will be evaluated. Responses not in this time grid cannot appear.  | 
pdfND | 
 either a vector of length tt specifying the nondecision density for all condition-response pairs,
or a matrix where columns corresponds to the nondecision densities of condition-response pairs. Supplying   | 
fun.density | 
 Density function to use.  | 
args.density | 
 Additional arguments to be passed to   | 
npars | 
 Number of parameters   | 
return.pdf | 
 Logical, if TRUE   | 
normalizePdfs | 
 Logical, should the pdf of the nondecision distribution be normalized?  | 
Simulate data via multinomial sampling.
The response options to sample from should be provided in tt.
The number of conditions is defined as length(pars) / npars.
A sorted dataframe where rows represent trials. It contains: a column named rt
containing reaction times in seconds, a column named response containing either
response option lower or upper, and a column named condition indicating which
condition a trials belongs to. If return.pdf is TRUE it returns a list where the
first element is the sorted dataframe, the second through the fifth elements are lists
that contain densities used for simulating data.
tt = seq(0, 5, .01)
pdfND = dbeta(tt, 10, 30)
n = 100
pars = c(1, 2, .5, .5, .5)
dat = simData(n, pars, tt, pdfND)
head(dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.