EstimatorMetaD#
- class EstimatorMetaD(data=None, bins=None, cl=None, parallel=False, libraries=['numpy', 'pandas'], prior=False, display=False, ppt_identifier=None, ignore_invalid=False, **kwargs)[source]#
Bases:
objectClass to estimate metacognitive parameters using the meta-d model proposed by Maniscalco and Lau (2012).
- Parameters:
- data
pd.DataFrame, pd.DataFrameGroupBy DataFrame containing the data to be analyzed. See Note below.
- bins
int Number of bins to use for binning the confidence ratings.
- cl
int, optional Number of cores to use for parallel processing. If None, all available cores will be used.
- parallelbool, default
False If True, parallel processing will be used.
- libraries
listofstr, default [“numpy”, “pandas”] List of libraries to use for parallel processing in Jupyter. Default is [“numpy”, “pandas”].
- priorbool, default
False If True, the log likelihoods will incorporate prior density of parameters.
- display
int, default 0 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).
- ppt_identifier
str, optional The column that identifies the participants in the data. Required if
datais a pandas.DataFrame. Ifdatais grouped by a single column, such asdata.groupby("ppt"), it defaults to the name of that column.- ignore_invalidbool, default
False If True, invalid confidence ratings will be ignored during binning. If False, an error will be raised if invalid ratings are found. We recommend setting this to False (Default).
- **kwargsadditional keyword arguments
Additional keyword arguments to be passed to the optimization function.
- data
- Returns:
- An EstimatorMetaD object.
Notes
The data DataFrame should contain the following columns:
‘participant’: Identifier for each participant.
‘signal’ (integer): Stimulus presented to the participant, for example, 0 for S1 and 1 for S2.
‘response’ (integer): Participant’s response to the stimulus.
‘confidence’ (integer, float): Participant’s confidence rating for their response.
‘accuracy’ (integer): Accuracy of the participant’s response. 0 = incorrect, 1 = correct.
- optimise()[source]#
Estimates the metacognitive parameters using the meta-d model. Here, we use a Trust-Region Constrained Optimization algorithm (Conn et al., 2000) to fit the model to the data. We use the
trust-constrmethod fromscipy.optimize.minimizeto perform the optimization, and minimise the negative log-likelihood of the data given the model parameters. The optimization is performed for each participant in the data.Notes
If you want to tune the behaviour of the optimization, you can do so by passing additional keyword arguments to the class constructor. See the
scipy.optimize.minimize()documentation for more details on the available options. By default, the optimization will use thetrust-constrmethod with the default options specified in thescipy.optimize.minimizedocumentation.References
Conn, A. R., Gould, N. I. M., & Toint, P. L. (2000). Trust Region Methods. Society for Industrial and Applied Mathematics. https://doi.org/10.1137/1.9780898719857