metadpy.sdt.rates#
- metadpy.sdt.rates(data: None, hits: None, misses: None, fas: None, crs: None, stimuli: Union[List[Any], Any], responses: Union[List[Any], Any], correction: bool = True) Tuple[float, float] [source]#
- metadpy.sdt.rates(data: DataFrame, hits: None, misses: None, fas: None, crs: None, stimuli: str, responses: str, correction: bool = True) Tuple[float, float]
- metadpy.sdt.rates(data: None, hits: int, misses: int, fas: int, crs: int, stimuli: None, responses: None, correction: bool = True) Tuple[float, float]
Compute hit and false alarm rates.
The values are automatically corrected to avoid d’ infinity (see below).
- Parameters
- data
Dataframe containing one stimuli and one response column.
- 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 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 and data is a
pandas.DataFrame
, will be set to Responses by default.- hits
Hits.
- misses
Misses.
- fas
False alarms.
- crs
Correct rejections.
- correction
Avoid d’ infinity by correcting false alarm and hit rate values if equal to 0 or 1 using half inverse or 1 - half inverse. Half inverses values are defined by:
half_hit = 0.5 / (hits + misses) half_fa = 0.5 / (fas + crs)
Default is set to True (use correction).
- Returns
- hit_rate:
Hit rate.
- fa_rate
False alarm rate.
- Raises
- ValueError:
If no valid data are provided.
References
Adapted from: https://lindeloev.net/calculating-d-in-python-and-php/