cardioception.stats.psychophysics#

cardioception.stats.psychophysics(summary_df: DataFrame, variables: List[str] = ['participant_id', 'Modality'], additional_variables=[]) DataFrame[source]#

Extract psychometric parameters from a set of result files from the HRD task.

This function will use a Bayesian model to estimate psychophysics parameters and perform inference using MCMC sampling. The following parameters are returned:

  • Interoceptive bias

    • bayesian_threshold (the mean of the interoceptive bias)

    • bayesian_slope (the slope of the interoceptive bias)

The interoceptive bias \(\alpha\) represents the difference between the real heart rate and the cardiac belief. The interoceptive slope \(\beta\) represents the precision of this bias (the standard deviation of the underlying cumulative normal function). These parameters are estimated using the following model:

\[\begin{split}r_{i} & \sim \mathcal{Binomial}(\theta_{i},n_{i}) \\ \Phi_{i}(x_{i}, \alpha, \beta) & = \frac{1}{2} + \frac{1}{2} * erf(\frac{x_{i} - \alpha}{\beta * \sqrt{2}}) \\ \alpha & \sim \mathcal{Uniform}(-50.5, 50.5) \\ \beta & \sim \mathcal{Uniform}(.1, 30.0) \\\end{split}\]

Here \(x_i\) is the proportion of positive response at the intensity \(i\). To compute the interoceptive bias, we use the Alpha value (the difference between the real heart rate and the tone that is presented at each trial). A negative value means that the tone needs to be slower than the heart rate for the participant to find it the same.

  • Cardiac beliefs

    • belief_mean

    • belief_std

The mean of the cardiac belief \(\psi_{alpha}\) represents the cardiac frequency that was inferred on average through the task. The precision of the cardiac belief \(\psi_{beta}\) is the standard deviation around this belief. Under the hypothesis that the participant is not using any interoceptive information to perform the task, this value is the belief used to inform the decision by comparing it to the tones. These parameters are estimated using the following model:

\[\begin{split}r_{i} & \sim \mathcal{Binomial}(\theta_{i},n_{i}) \\ \Phi_{i}(x_{i}, \psi_{alpha}, \psi_{beta}) & = \frac{1}{2} + \frac{1}{2} * erf(\frac{x_{i} - \psi_{alpha}}{\psi_{beta} * \sqrt{2}}) \\ \psi_{alpha} & \sim \mathcal{Uniform}(15.0, 200.0) \\ \psi_{beta} & \sim \mathcal{Uniform}(.1, 50.0) \\\end{split}\]

Here \(x_i\) is the proportion of positive response at the intensity \(i\). To compute the interoceptive bias, we use the frequency of the tone presented during the decision phase only (assuming therefore that this is the only source of information used by the participant). The units are beat per minute (bpm).

Note

In the two equations above, $erf$ denotes the error functions and \(\phi\) is the cumulative normal function.

  • Heart rate

    • hr_mean the mean of the averaged heart rates

    • hr_std the standard deviation of the averaged heart rates

The mean of the averaged heart rates \(\omega_{alpha}\) and the standard deviation of the averaged heart rates \(\omega_{beta}\) are computed using the following model:

\[\begin{split}r_{i} & \sim \mathcal{Normal}(\omega_{alpha},\omega_{beta}) \\ \omega_{alpha} & \sim \mathcal{Uniform}(15.0, 200.0) \\ \omega_{beta} & \sim \mathcal{Uniform}(.1, 50.0) \\\end{split}\]

Here \(x_i\) is the average heart rate at each trial.

Note

The heart rate that was recorded on every trial is the average of what was recorded over the 5 seconds of interoception during the listening phase. Here we are returning the mean and standard deviation of these values.

Warning

This function requires PyMC.

Parameters
summary_df

The data frame merges the individual result data frames. Multiple variables/ condition can be specified using separate columns with the variables argument.

variables

The variables coding for group/repeated measures. The default is participant_id and Modality.

additional_variables

Additional variables for group/repeated measures.

Returns
results_df

The data frame containing, for each participant/condition/group, the psychometric variables.