quickpsy | R Documentation |
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 asymppotes at 0 and 1.
quickpsy( d, x = x, k = k, n = NULL, grouping = c(), xmin = NULL, xmax = NULL, log = FALSE, fun = cum_normal_fun, parini = NULL, guess = 0, lapses = 0, prob = NULL, thresholds = TRUE, bootstrap = "parametric", B = 100, ci = 0.95, control = NULL, parinivector = NULL, paircomparisons = FALSE )
d |
Data frame with 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. It could be the number of trials in which a yes-type response was given or a vector of 0s (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
|
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 for the predefined functions by linear modelling of
the probit-transformed data. Otherwise,
|
guess |
Value indicating the guess rate (leftward asymptote) γ
(default is 0). If |
lapses |
Value indicating the lapse rate (rightward asymptote) λ
(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 |
Bootstrap confidence intervals level based on percentiles (default is .95). |
control |
|
parinivector |
A optional vector of initials parameters when the lower and the upper bounds of the parameter are specified. |
paircomparisons |
If |
A list containing the following components:
x, k, n
grouping
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.
ypred
Predicted probabilities at the values of the explanatory
variable.
curves
Psychometric curves.
par
Fitted parameters and its confidence intervals.
parcomnparisons
Pair-wise comparisons of the parameters
to assess whether two parameters are significantly different
using bootstrap. Specifically, the parameter bootstrap samples for each of
the two conditions are substrated and then it is considered whether zero
was within the confidence interval level of the distributions of differences.
curvesbootstrap
Bootstrap psychometric curves.
thresholds
Thresholds and its confidence intervals.
thresholdscomparisons
Pair-wise comparisons of 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
using the chi-square distribution and 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.
library(quickpsy) fit <- quickpsy(qpdat, phase, resp, grouping = c("participant", "cond"), bootstrap = "none") plot(fit) plot(fit, color = cond) plotpar(fit) plotthresholds(fit, geom = "point")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.