MACS3.Signal.Prob module
Module Description: statistics functions to calculate p-values
This code is free software; you can redistribute it and/or modify it under the terms of the BSD License (see the file LICENSE included with the distribution).
- MACS3.Signal.Prob.binomial_cdf(x, a, b, lower=True)
BINOMIAL_CDF compute the binomial CDF.
CDF(x)(A,B) is the probability of at most X successes in A trials, given that the probability of success on a single trial is B.
- Return type:
_fake_callable
- MACS3.Signal.Prob.binomial_cdf_inv(cdf, a, b)
BINOMIAL_CDF_INV inverts the binomial CDF. For lower tail only!
- Return type:
_fake_callable
- MACS3.Signal.Prob.binomial_coef(n, k)
BINOMIAL_COEF computes the Binomial coefficient C(N,K)
n,k are integers.
- Return type:
_fake_callable
- MACS3.Signal.Prob.binomial_pdf(x, a, b)
binomial PDF by H. Gene Shin
- Return type:
_fake_callable
- MACS3.Signal.Prob.binomial_sf(x, a, b, lower=True)
BINOMIAL_SF compute the binomial survival function (1-CDF)
SF(x)(A,B) is the probability of more than X successes in A trials, given that the probability of success on a single trial is B.
- Return type:
_fake_callable
- MACS3.Signal.Prob.bool(*args, **kwargs)
- MACS3.Signal.Prob.chisq_logp_e(x, df, log10=False)
Chisq CDF function in log space for upper tail and even degree of freedom Good for p-value calculation and designed for combining pvalues.
Note: we assume df to be an even number larger than 1! Do not violate this assumption and there is no checking.
Return value is -logp. If log10 is set as True, return -log10p instead.
- Return type:
_fake_callable
- MACS3.Signal.Prob.chisq_pvalue_e(x, df)
Chisq CDF function for upper tail and even degree of freedom. Good for p-value calculation and designed for combining pvalues.
Note: we assume df to be an even number larger than 1! Do not violate this assumption and there is no checking.
df has to be even number! if df is odd, result will be wrong!
- Return type:
_fake_callable
- MACS3.Signal.Prob.ex20(x)
Wrapper on exp function. It will return 0 if x is smaller than -20.
- Return type:
_fake_callable
- MACS3.Signal.Prob.exp(*args, **kwargs)
- MACS3.Signal.Prob.factorial(n)
Calculate N!.
- Return type:
_fake_callable
- MACS3.Signal.Prob.float32_t(*args, **kwargs)
- MACS3.Signal.Prob.float64_t(*args, **kwargs)
- MACS3.Signal.Prob.int32_t(*args, **kwargs)
- MACS3.Signal.Prob.int64_t(*args, **kwargs)
- MACS3.Signal.Prob.log(*args, **kwargs)
- MACS3.Signal.Prob.log10_poisson_cdf_P_large_lambda(k, lbd)
Slower Poisson CDF evaluater for lower tail which allow calculation in log space. Better for the pvalue < 10^-310.
Parameters: k : observation lbd : lambda
ret = -lambda + ln( sum_{i=k+1}^{inf} {lambda^i/i!} = -lambda + ln(sum{ exp{ln(F)} }), where F=lambda^m/m! ln{F(m)} = m*ln{lambda} - sum_{x=1}^{m}ln(x) Calculate ln( sum{exp{N} ) by logspace_add function
Return the log10(pvalue)
- Return type:
_fake_callable
- MACS3.Signal.Prob.log10_poisson_cdf_Q_large_lambda(k, lbd)
Slower Poisson CDF evaluater for upper tail which allow calculation in log space. Better for the pvalue < 10^-310.
Parameters: k : observation lbd : lambda
ret = -lambda + ln( sum_{i=k+1}^{inf} {lambda^i/i!} = -lambda + ln( sum{ exp{ln(F)} } ), where F=lambda^m/m! ln{F(m)} = m*ln{lambda} - sum_{x=1}^{m}ln(x) Calculate ln( sum{exp{N} ) by logspace_add function
Return the log10(pvalue)
- Return type:
_fake_callable
- MACS3.Signal.Prob.logspace_add(logx, logy)
addition in log space.
Given two log values, such as logx and logy, return log(exp(logx)+exp(logy)).
- Return type:
_fake_callable
- MACS3.Signal.Prob.pduplication(pmf, N_obs)
return the probability of a duplicate fragment given a pmf and a number of observed fragments N_obs
- Return type:
_fake_callable
- MACS3.Signal.Prob.pnorm(x, u, v)
The probability of X=x when X=Norm(u,v)
v is int32_t
- MACS3.Signal.Prob.pnorm2(x, u, v)
The probability of X=x when X=Norm(u,v)
v is float32_t
- Return type:
_fake_callable
- MACS3.Signal.Prob.poisson_cdf(n, lam, lower=False, log10=False)
Poisson CDF evaluater.
This is a more stable CDF function. It can tolerate large lambda value. While the lambda is larger than 700, the function will be a little slower.
Parameters: n : your observation lam : lambda of poisson distribution lower : if lower is False, calculate the upper tail CDF, otherwise, to
calculate lower tail; Default is False.
- log10if log10 is True, calculation will be in log space. Default is
False.
- Return type:
_fake_callable
- MACS3.Signal.Prob.poisson_cdf_Q_inv(cdf, lam, maximum=1000)
inverse poisson distribution.
cdf : the CDF lam : the lambda of poisson distribution
note: maxmimum return value is 1000 and lambda must be smaller than 740.
- Return type:
_fake_callable
- MACS3.Signal.Prob.poisson_cdf_inv(cdf, lam, maximum=1000)
inverse poisson distribution.
cdf : the CDF lam : the lambda of poisson distribution
note: maxmimum return value is 1000 and lambda must be smaller than 740.
- Return type:
_fake_callable
- MACS3.Signal.Prob.poisson_pdf(k, a)
Poisson PDF.
PDF(K,A) is the probability that the number of events observed in a unit time period will be K, given the expected number of events in a unit time as A.
- Return type:
_fake_callable
- MACS3.Signal.Prob.poz(z)
probability of normal z value
- Return type:
_fake_callable
- MACS3.Signal.Prob.uint32_t(*args, **kwargs)
- MACS3.Signal.Prob.uint64_t(*args, **kwargs)