Description Usage Arguments Value References See Also Examples
quickpsy
fits, by direct maximization of the likelihood
(Prins and Kingdom, 2010; Knoblauch and Maloney, 2012),
psychometric functions of the form
ψ(x) = γ + (1 - γ - λ) * fun(x)
where γ is the guess rate, λ is the lapse rate and fun is a sigmoidal-shape function with asymptotes at 0 and 1.
1 2 3 4 |
d |
Data frame with the results of a Yes-No experiment to fit. It should have a tidy form in which each column corresponds to a variable and each row is an observation. |
x |
Name of the explanatory variable. |
k |
Name of the response variable. The response variable could be the number of trials in which a yes-type response was given or a vector of 0s (or -1s; no-type response) and 1s (yes-type response) indicating the response on each trial. |
n |
Only necessary if |
grouping |
Name of the grouping variables. It should be specified as
|
random |
Name of the random variable. It should be specified as
|
within |
Name of the within variable. It should be specified as
|
between |
Name of the between variable. It should be specified as
|
xmin |
Minimum value of the explanatory variable for which the curves should be calculated (the default is the minimum value of the explanatory variable). |
xmax |
Maximum value of the explanatory variable for which the curves should be calculated (the default is the maximum value of the explanatory variable). |
log |
If |
fun |
Name of the shape of the curve to fit. It could be a predefined
shape ( |
parini |
Initial parameters. quickpsy calculates default
initial parameters using probit analysis, but it is also possible to
specify a vector of initial parameters or a list of the form
|
guess |
Value indicating the guess rate γ (default is 0). If
|
lapses |
Value indicating the lapse rate λ (default is 0).
If |
prob |
Probability to calculate the threshold (default is
|
thresholds |
If |
bootstrap |
|
B |
number of bootstrap samples (default is 100 ONLY). |
ci |
Confidence intervals level based on percentiles (default is .95). |
optimization |
Method used for optimization. The default is 'optim' which uses
the |
A list containing the following components:
x, k, n
groups
The grouping variables.
funname
String with the name of the shape of the curve.
psyfunguesslapses
Curve including guess and lapses.
limits
Limits of the curves.
parini
Initial parameters.
optimization
Method to optimize.
pariniset
FALSE
if initial parameters are not given.
ypred
Predicted probabilities at the values of the explanatory
variable.
curves
Curves.
par
Fitted parameters and its confidence intervals.
curvesbootstrap
Bootstrap curves.
thresholds
Thresholds.
thresholdsci
Confidence intervals for the thresholds.
logliks
Log-likelihoods of the model.
loglikssaturated
Log-likelihoods of the saturated model.
deviance
Deviance of the model and the p-value calculated by
bootstraping.
aic
AIC of the model defined as
- 2 * loglik + 2 *k
where k is the number of parameters of the model.
Burnham, K. P., & Anderson, D. R. (2003). Model selection and multimodel inference: a practical information-theoretic approach. Springer Science & Business Media.
Knoblauch, K., & Maloney, L. T. (2012). Modeling Psychophysical Data in R. New York: Springer.
Prins, N., & Kingdom, F. A. A. (2016). Psychophysics: a practical introduction. London: Academic Press.
1 2 3 4 5 6 7 8 | # make sure that all the requires packages are installed
# and loaded; instructions at https://github.com/danilinares/quickpsy
library(MPDiR) # contains the Vernier data; use ?Vernier for the reference
fit <- quickpsy(Vernier, Phaseshift, NumUpward, N,
grouping = .(Direction, WaveForm, TempFreq), B = 10)
plotcurves(fit)
plotpar(fit)
plotthresholds(fit, geom = 'point')
|
Loading required package: DEoptim
Loading required package: parallel
DEoptim package
Differential Evolution algorithm in R
Authors: D. Ardia, K. Mullen, B. Peterson and J. Ulrich
Loading required package: dplyr
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Loading required package: ggplot2
Attaching package: 'quickpsy'
The following object is masked from 'package:stats':
deviance
Warning: Ignoring unknown aesthetics: fill
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.