metadpy.sdt.roc_auc#

metadpy.sdt.roc_auc(data: None, stimuli: None, responses: None, accuracy: None, confidence: None, nRatings: None, nR_S1: Union[list, ndarray], nR_S2: Union[list, ndarray]) float[source]#
metadpy.sdt.roc_auc(data: None, stimuli: Union[list, ndarray], responses: Union[list, ndarray], accuracy: Union[list, ndarray], confidence: Union[list, ndarray], nRatings: None, nR_S1: None, nR_S2: None) float
metadpy.sdt.roc_auc(data: DataFrame, stimuli: str, responses: str, accuracy: str, confidence: str, nRatings: int, nR_S1: None, nR_S2: None) float

Calculate the area under the type 2 ROC curve given from confidence ratings.

Parameters
data

Dataframe containing one “stimuli” and one “response” column. Different column names can also be provided using the stimuli and responses parameters.

stimuli

If a string is provided, should be the name of the column used as stimuli. If a list or an array is provided, should contain the boolean vectors for stimuli. If None (default) and data is a pandas.DataFrame, will be set to Stimuli by default.

responses

If a string is provided, should be the name of the column used as responses. If a list or an array is provided, should contain the boolean vector for responses. If None (default) and data is a pandas.DataFrame, will be set to Responses by default.

accuracy

If a string is provided, should be the name of the column used as accuracy. If a list or an array is provided, should contain the boolean vector for accuracy. If None (default) and data is a pandas.DataFrame, will be set to Accuracy by default. This parameter is optional if stimuli and responses are known.

confidence

If a string is provided, should be the name of the column used as confidence. If a list or an array is provided, should contain the confidence ratings, matching the number of discret ratings provided in the nRatings parameter. If None (default) and data is a pandas.DataFrame, will be set to Confidence by default.

nRatings

Total of available subjective ratings available for the subject. e.g. if subject can rate confidence on a scale of 1-4, then nRatings = 4. Default is None.

nR_S1

Confience ratings (stimuli 1).

nR_S2

Confidence ratings (stimuli 2).

Returns
auc

Area under the type 2 ROC curve.

Raises
ValueError:

If data and both nR_S1 and nR_S2 are missing.

Examples

>>> nR_S1 = [36, 24, 17, 20, 10, 12, 9, 2]
>>> nR_S2 = [1, 4, 10, 11, 19, 18, 28, 39]
>>> roc_auc(nR_S1, nR_S2)
0.6998064266356949