metadpy.mle.fit_metad#
- metadpy.mle.fit_metad(nR_S1: ~numpy.ndarray, nR_S2: ~numpy.ndarray, nRatings: int, nCriteria: ~typing.Optional[int] = None, s: int = 1, verbose: int = 0, fninv: ~typing.Callable = <bound method rv_continuous.ppf of <scipy.stats._continuous_distns.norm_gen object>>, fncdf: ~typing.Callable = <numba._DUFunc 'norm_cdf'>) Dict [source]#
Fit metad model using MLE.
- 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
metadpy.utils.discreteRatings()
. 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: * ‘dprime’ : mean(S2) - mean(S1), in root-mean-square(sd(S1), sd(S2))
units
‘s’ : sd(S1) / sd(S2)
‘meta_d’ : meta-d’ in RMS units
‘m_diff’ : meta_da - da
‘m_ratio’ : meta_da / da
‘meta_ca’ : 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.