module documentation

TODO write brief introduction to d-prime measure

Function dprime_analytical Computes the d-prime of two internal response distributions, e.g. from signal present and signal absent.
Function dprime_empirical Compute dprime from hit rate and false-alarm rate
Function dprime_empirical_jones Algorithm copied from Pete R Jones (supplementary material to Jones 2016
Function ideal_threshold Computes the ideal threshold between the two distributions, signal and noise.
Function inverse_cumulative_std_normfunc The inverse cumulative standard norm-function. This yields the same result as norminv, i.e. norminv(x, mu=0., std=1.) == inverse_cumulative_std_normfunc(x).
Function norminv Replica of the Matlab function norminv (Normal inverse cumulative distribution function)
def dprime_analytical(mu1, mu2, std1, std2): (source)

Computes the d-prime of two internal response distributions, e.g. from signal present and signal absent.

It assumes the simplest form of internal response, thus no correlation etc. (see Jones 2016 for a thorough tutorial).

Parameters
mu1Mean of distribution 1
mu2Mean of distribution 2
std1Standard deviation of distribution 1
std2Standard deviation of distribution 1
Returns
def dprime_empirical(hit_rate, false_alarm_rate): (source)

Compute dprime from hit rate and false-alarm rate

Parameters
hit_rateNumber of "yes" responses given a stimulus with the signal, divided by the number of presentations with signal
false_alarm_rateNumber of "yes" responses given a stimulus with the signal, divided by the number of presentations without signal
Returns
def dprime_empirical_jones(h, f, threshold=0.5, eps=0.5): (source)

Algorithm copied from Pete R Jones (supplementary material to Jones 2016

Parameters
hinternal variable responses due to stimuli with signal
finternal variable responses due to stimuli without signal
thresholdthreshold for determining whether response was a "yes" or "no"
epscorrection factor for avoiding infinite results
Returns
def ideal_threshold(signal, noise): (source)

Computes the ideal threshold between the two distributions, signal and noise.

We use E(x) as the expected value of x, and estimate this by the mean of the samples provided.

When the E(noise) samples are larger than the E(signal), the ideal threshold returned is E(noise).

Otherwise, (E(signal) + E(noise)) / 2 is returned, i.e. the mean of the means.

Parameters
signalresponses due to stimuli with signal
noiseresponses due to stimuli without signal, i.e. noise only
Returns
the ideal threshold between the two distributions
@check_annotations
def inverse_cumulative_std_normfunc(p): (source)

The inverse cumulative standard norm-function. This yields the same result as norminv, i.e. norminv(x, mu=0., std=1.) == inverse_cumulative_std_normfunc(x).

Equation originates from Jones 2016

Parameters
p:Annotated[float, ValueRange(0.0, 1.0, False, False)]probability values (must be in the range [0, 1])
Returns
def norminv(p, mu=0.0, std=1.0): (source)

Replica of the Matlab function norminv (Normal inverse cumulative distribution function)

Parameters
pProbability values at which to evaluate the inverse of the cdf (icdf), specified as a scalar value or an array of scalar values, where each element is in the range [0,1].
muMean of the normal distribution, specified as a scalar value or an array of scalar values.
stdStandard deviation of the normal distribution, specified as a positive scalar value or an array of positive scalar values.
Returns
returns the inverse of the normal cdf with mean mu and standard deviation sigma, evaluated at the probability values in p.