MulaiMulai sekarang secara gratis

Applying Bonferoni correction

After identifying significant differences between therapy groups with Tukey's HSD, we want to confirm our findings with the Bonferroni correction. The Bonferroni correction is a conservative statistical adjustment used to counteract the problem of multiple comparisons. It reduces the chance of obtaining false-positive results by adjusting the significance level. In the context of your study on the effectiveness of CBT, DBT, and ACT, applying the Bonferroni correction will help ensure that the significant differences you observe between therapy groups are not due to chance.

The therapy_outcomes DataFrame has again been loaded along with pandas as pd, from scipy.stats import ttest_ind, and from statsmodels.sandbox.stats.multicomp import multipletests.

Latihan ini adalah bagian dari kursus

Experimental Design in Python

Lihat Kursus

Petunjuk latihan

  • Conduct independent t-tests between all pairs of therapy groups in therapy_pairs and append the p-values (p_val) to the p_values list.
  • Apply the Bonferroni correction to adjust the p-values from the multiple tests and print them.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

p_values = []

therapy_pairs = [('CBT', 'DBT'), ('CBT', 'ACT'), ('DBT', 'ACT')]

# Conduct t-tests and collect P-values
for pair in ____:
    group1 = therapy_outcomes[therapy_outcomes['Therapy_Type'] == ____]['Anxiety_Reduction']
    group2 = therapy_outcomes[therapy_outcomes['Therapy_Type'] == ____]['Anxiety_Reduction']
    t_stat, p_val = ____(group1, group2)
    p_values.____(p_val)

# Apply Bonferroni correction
print(____(____, alpha=0.05, method='____')[1])
Edit dan Jalankan Kode