def test_cochran(self):
     """Test function cochran"""
     from pingouin.datasets import read_dataset
     df = read_dataset('cochran')
     st = cochran(dv='Energetic', within='Time', subject='Subject', data=df)
     assert st.loc['cochran', 'Q'] == 6.706
     cochran(dv='Energetic', within='Time', subject='Subject', data=df,
             export_filename='test_export.csv')
     # With a NaN value
     df.loc[2, 'Energetic'] = np.nan
     cochran(dv='Energetic', within='Time', subject='Subject', data=df)
Beispiel #2
0
 def test_cochran(self):
     """Test function cochran
     http://www.real-statistics.com/anova-repeated-measures/cochrans-q-test/
     """
     from pingouin import read_dataset
     df = read_dataset('cochran')
     st = cochran(dv='Energetic', within='Time', subject='Subject', data=df)
     assert st.loc['cochran', 'Q'] == 6.706
     assert np.allclose(st.loc['cochran', 'p-unc'], 0.034981)
     cochran(dv='Energetic', within='Time', subject='Subject', data=df)
     # With a NaN value
     df.loc[2, 'Energetic'] = np.nan
     cochran(dv='Energetic', within='Time', subject='Subject', data=df)
Beispiel #3
0
 def test_cochran(self):
     """Test function cochran
     http://www.real-statistics.com/anova-repeated-measures/cochrans-q-test/
     """
     from pingouin import read_dataset
     df = read_dataset('cochran')
     st = cochran(dv='Energetic', within='Time', subject='Subject', data=df)
     assert round(st.at['cochran', 'Q'], 3) == 6.706
     assert np.isclose(st.at['cochran', 'p-unc'], 0.034981)
     # With Categorical
     df['Time'] = df['Time'].astype('category')
     df['Subject'] = df['Subject'].astype('category')
     df['Time'] = df['Time'].cat.add_categories("Unused")
     st = cochran(dv='Energetic', within='Time', subject='Subject', data=df)
     assert round(st.at['cochran', 'Q'], 3) == 6.706
     assert np.isclose(st.at['cochran', 'p-unc'], 0.034981)
     # With a NaN value
     df.loc[2, 'Energetic'] = np.nan
     cochran(dv='Energetic', within='Time', subject='Subject', data=df)