Description Usage Arguments Value See Also Examples
The function simulates data of a typical psychophysics experiment. For each simulated participant, the function returns the following information: individual slope and intercept coefficients, given the fixed and random effects parameters provided as input; summary of the simulated binomial response to a range of intensity levels between a specified range.
1 2 3 4 5 6 7 8 9 | PsySimulate(
fixeff = c(-7, 0.0875),
raneff = c(2.4, -0.002, 2e-06),
nsubjects = 8,
ntrials = 40,
nintervals = 9,
xint = c(40, 120),
constant = T
)
|
fixeff |
array of fixed effects. First item is the intercept, second item is the slope. |
raneff |
array of random effects. First item is the intercept, second item is the covariance, third item is the slope. |
nsubjects |
number of subjects to simulate. Default is 8. |
ntrials |
number of trials for each stimulus level. Default is 40. |
nintervals |
number of stimulus levels. Default is 9. |
xint |
range of the stimulus interval. Default is c(40,120) |
constant |
logical. If set to FALSE, stimulus levels are randomly generated, uniformly distributed values within the selected interval. otherwise, the X interval is divided in intervals of constant length. Default is TRUE. |
PsySimulate
returns a simulated dataset. If no input arguments are specified, the function returns
a dataset with the same characteristics as simul_data
.
PsychShape
for plotting a psychometric function given PSE and JND.
1 2 3 4 5 6 7 | datafr.S1 <- PsySimulate(fixeff = c(0, 1), xint = c(-5,5),
nsubject = 1, ntrials = 60, nintervals = 10, constant = FALSE)
library(ggplot2)
g <- ggplot(datafr.S1, aes(X,Longer/Total)) + geom_point()
PsychShape(pse = 0, jnd = qnorm(0.75)/1, ps.link = "probit",
x.range = c(-5,5), addTo = g, ps.color = "red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.