int main() { /* This test is thanks to Nick Eriksson, who sent it to me in the form of a bug report. */ apop_data * testdata = apop_data_falloc((2, 3), 30, 50, 45, 34, 12, 17 ); apop_data * t2 = apop_test_fisher_exact(testdata); assert(fabs(apop_data_get(t2,1) - 0.0001761) < 1e-6); }
int main(){ apop_data *data = apop_data_falloc((2, 2), 30, 86, 24, 38 ); double stat, chisq; stat = calc_chi_squared(data); chisq = gsl_cdf_chisq_Q(stat, (data->matrix->size1 - 1)* (data->matrix->size2 - 1)); printf("chi squared statistic: %g; p, Chi-squared: %g\n", stat,chisq); apop_data_show(apop_test_anova_independence(data)); apop_data_show(apop_test_fisher_exact(data)); }