yasa.SleepStatsAgreement.calibrate#

SleepStatsAgreement.calibrate(data, bias_method='auto')[source]#

Calibrate a DataFrame of sleep statistics from a new scorer based on observed biases in obs_data/obs_scorer.

Parameters:
datapandas.DataFrame

A pandas.DataFrame with sleep statistics from an observed scorer. Rows are unique observations and columns are unique sleep statistics.

bias_methodstr

If 'param', sleep statistics are always adjusted based on parametric bias, i.e. the mean difference is subtracted from data. If 'auto' (default), the parametric bias is used for all sleep statistics with a constant bias, and a NotImplementedError is raised if data contains a sleep statistic with a proportional bias (see assumptions). 'regr' (regression-modeled bias) is not implemented yet and raises a NotImplementedError.

See also

summary

Returns:
calibrated_datapandas.DataFrame

A DataFrame with calibrated sleep statistics: x - bias_mean.

Raises:
NotImplementedError

If bias_method='regr', or if bias_method='auto' and data contains a sleep statistic with a proportional bias. To calibrate only the statistics with a constant bias, subset the columns of data, or use bias_method='param' to subtract the mean difference from all statistics.