Patterns in static

Apophenia

Macros | Enumerations | Functions | Variables
apop_fexact.c File Reference

Macros

#define i_real   4
 
#define i_int   2
 
#define dwrk   (equiv)
 
#define iwrk   ((int *)equiv)
 
#define rwrk   ((float *)equiv)
 

Enumerations

enum  Rboolean { FALSE = 0, TRUE }
 

Functions

int imax2 (int a, int b)
 
int imin2 (int a, int b)
 
float fmax2 (float a, float b)
 
float fmin2 (float a, float b)
 
void prterr (int icode, const char *mes)
 
apop_dataapop_test_fisher_exact (apop_data *intab)
 

Variables

threadlocal bool has_error
 

Detailed Description

Fisher's exact test for contingency tables

This file primarily consists of an algorithm from the ACM, fully documented below. The C code below was cut and pasted from the R project. Thanks, guys.

Un-R-ifying modifications Copyright (c) 2006–2009 by Ben Klemens. Licensed under the modified GNU GPL v2; see COPYING and COPYING2.

R version credits: fexact.f – translated by f2c (version 19971204).\ Run through a slightly modified version of MM's f2c-clean.\ Heavily hand-edited by KH and MM.

Function Documentation

apop_data* apop_test_fisher_exact ( apop_data intab)

Run the Fisher exact test on an input contingency table.

Returns
An apop_data set with two rows:
"probability of table": Probability of the observed table for fixed marginal totals.
"p value": Table p-value. The probability of a more extreme table, where `extreme' is in a probabilistic sense.
Exceptions
out->error=='p'Processing error in the test.
  • If there are processing errors, these values will be NaN. For example:
#include <apop.h>
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 );
assert(fabs(apop_data_get(t2,1) - 0.0001761) < 1e-6);
}

Autogenerated by doxygen on Wed Oct 15 2014 (Debian 0.999b+ds3-2).