2 * Copyright (C) 2008 Tao Liu.
4 * This code is free software; you can redistribute it and/or modify
5 * it under the terms of the Artistic License (see the file COPYING
6 * included with the distribution).
14 /* include GSL cdf function for poisson */
18 poisson_cdf_Q ( PyObject * self, PyObject * args)
24 if (! PyArg_ParseTuple(args, "di", &lambda,&k))
26 pvalue = gsl_cdf_poisson_Q (k,lambda);
27 return Py_BuildValue("d",pvalue);
32 binom_cdf_Q ( PyObject * self, PyObject * args)
39 if (! PyArg_ParseTuple(args, "dii", &p,&n,&k))
41 pvalue = gsl_cdf_binomial_Q(k,p,n);
42 return Py_BuildValue("d",pvalue);
45 static PyMethodDef pcdfMethods[] =
47 {"poisson_cdf_Q",poisson_cdf_Q,METH_VARARGS,"Calculate CDF for a poisson distribution ( for upper tail). Usage: poisson_cdf_Q(lambda,k); Return: P-value"},
48 {"binom_cdf_Q",binom_cdf_Q,METH_VARARGS,"Calculate CDF for a binomial distribution ( for upper tail). Usage: binom_cdf_Q(p,n,k); Return: P-value"},
55 m = Py_InitModule("cdf",pcdfMethods);