{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _hypotests / _get_binomial_log_p_value_with_nuisance_param

function

scipy.stats._hypotests:_get_binomial_log_p_value_with_nuisance_param

source: /scipy/stats/_hypotests.py :1469

Signature

def   _get_binomial_log_p_value_with_nuisance_param ( nuisance_param x1_sum_x2 x1_sum_x2_log_comb index_arr )

Summary

Compute the log pvalue in respect of a nuisance parameter considering a 2x2 sample space.

Parameters

nuisance_param : float

nuisance parameter used in the computation of the maximisation of the p-value. Must be between 0 and 1

x1_sum_x2 : ndarray

Sum of x1 and x2 inside barnard_exact

x1_sum_x2_log_comb : ndarray

sum of the log combination of x1 and x2

index_arr : ndarray of boolean

Returns

p_value : float

Return the maximum p-value considering every nuisance parameter between 0 and 1

Notes

Both Barnard's test and Boschloo's test iterate over a nuisance parameter to find the maximum p-value. To search this maxima, this function return the negative log pvalue with respect to the nuisance parameter passed in params. This negative log p-value is then used in shgo to find the minimum negative pvalue which is our maximum pvalue.

Also, to compute the different combination used in the p-values' computation formula, this function uses gammaln which is more tolerant for large value than scipy.special.comb. gammaln gives a log combination. For the little precision loss, performances are improved a lot.

Aliases

  • scipy.stats._hypotests._get_binomial_log_p_value_with_nuisance_param