fit_metad#

fit_metad(nR_S1, nR_S2, nRatings, nCriteria=None, s=1, verbose=0, fninv=<bound method rv_continuous.ppf of <scipy.stats._continuous_distns.norm_gen object>>, fncdf=<bound method rv_continuous.cdf of <scipy.stats._continuous_distns.norm_gen object>>, parameters=None, prior=False)[source]#

Estimate metacognitive parameters using the meta-d model proposed by Maniscalco and Lau (2012). This function fits the meta-d model to the data and returns the estimated parameters. It is done via maximum likelihood estimation (MLE) using the scipy.optimize.minimize function. The function uses the trust-constr method for optimization, which is suitable for constrained optimization problems.

Parameters:
nR_S1, nR_S2

These are vectors containing the total number of responses in each response category, conditional on presentation of S1 and S2. If nR_S1 = [100, 50, 20, 10, 5, 1], then when stimulus S1 was presented, the subject had the following response counts:

  • responded 'S1', rating=`3` : 100 times

  • responded 'S1', rating=`2` : 50 times

  • responded 'S1', rating=`1` : 20 times

  • responded 'S2', rating=`1` : 10 times

  • responded 'S2', rating=`2` : 5 times

  • responded 'S2', rating=`3` : 1 time

The ordering of response / rating counts for S2 should be the same as it is for S1. e.g. if nR_S2 = [3, 7, 8, 12, 27, 89], then when stimulus S2 was presented, the subject had the following response counts:

  • responded 'S1', rating=`3` : 3 times

  • responded 'S1', rating=`2` : 7 times

  • responded 'S1', rating=`1` : 8 times

  • responded 'S2', rating=`1` : 12 times

  • responded 'S2', rating=`2` : 27 times

  • responded 'S2', rating=`3` : 89 times

nRatings

Number of discrete ratings. If a continuous rating scale was used, and the number of unique ratings does not match nRatings, will convert to discrete ratings using cpm.utils.metad.bin_ratings(). Default is set to 4.

nCriteria

(Optional) Number criteria to be fitted. If None, the number of criteria is set to nCriteria = int(2 * nRatings - 1).

s

Ratio of standard deviations for type 1 distributions as: s = np.std(S1) / np.std(S2). If not specified, s is set to a default value of 1. For most purposes, it is recommended to set s=1. See http://www.columbia.edu/~bsm2105/type2sdt for further discussion.

verbose

Level of algorithm’s verbosity:

  • 0 (default) : work silently.

  • 1 : display a termination report.

  • 2 : display progress during iterations.

  • 3 : display progress during iterations (more complete report).

fninv

A function handle for the inverse CDF of the type 1 distribution. If not specified, fninv defaults to scipy.stats.norm.ppf.

fncdf

A function handle for the CDF of the type 1 distribution. If not specified, fncdf defaults to scipy.stats.norm.cdf.

Returns:
results

In the following, S1 and S2 represent the distributions of evidence generated by stimulus classes S1 and S2:

  • 'd' : d-prime, the distance between the means of the S1 and S2 distributions, in RMS units.

  • 's' : ratio of the standard deviations of the S1 and S2

  • 'meta_d' : meta-d’ in RMS units

  • 'm_diff' : meta_d - d

  • 'm_ratio' : meta_d / d

  • 'meta_c' : type 1 criterion for meta-d’ fit, RMS units.

  • 't2ca_rS1' : type 2 criteria of “S1” responses for meta-d’ fit, RMS units.

  • 't2ca_rS2' : type 2 criteria of “S2” responses for meta-d’ fit, RMS units.

  • 'logL' : log likelihood of the data fit

  • 'est_HR2_rS1' : estimated (from meta-d’ fit) type 2 hit rates for S1 responses.

  • 'obs_HR2_rS1' : actual type 2 hit rates for S1 responses.

  • 'est_FAR2_rS1' : estimated type 2 false alarm rates for S1 responses.

  • 'obs_FAR2_rS1' : actual type 2 false alarm rates for S1 responses.

  • 'est_HR2_rS2' : estimated type 2 hit rates for S2 responses.

  • 'obs_HR2_rS2' : actual type 2 hit rates for S2 responses.

  • 'est_FAR2_rS2' : estimated type 2 false alarm rates for S2 responses.

  • 'obs_FAR2_rS2' : actual type 2 false alarm rates for S2 responses.