Description Usage Arguments Details Value
View source: R/density_estimation.R
Estimate the parameters of the alternative density function using a mixture of chi-squared distributions of -2*log(P)-values.
1 | estimate_densities_pval(pvals, alt_prop, method_moments = FALSE)
|
pvals |
vector of P-values. |
alt_prop |
proportion of P-values from the alternative density. |
method_moments |
logical, denoting whether to estimate scale and degree of freedom
parameters using Method of Moments ( |
The function estimates densities under the null and under the alternative
given a vector of P-values from test statistics and the marginal probability of
coming from the alternative distribution. Under the null hypothesis,
-2*log()
transformed P-values follow a chi-squared distribution with 2 degrees of freedom.
Under the alternative, the function assumes that the -2*log()
transformed P-values
follow a scaled chi-squared distribution with unknown scale parameter and
unknown degrees of freedom.
When method_moments=TRUE
, the two unknown parameters are estimated by using the first and
second moments of the transformed P-values given the known proportion of alternatives
(specified in alt_prop
). The function solves a theoretical formula of the first and
second moments as functions of the scale parameter and degrees of freedom. Note that
the alternative density estimation may fail if alt_prop
is small and
method_moments=TRUE
.
When method_moments=FALSE
, the two unknown parameters are estimated by minimizing the differences
between the P-values given the parameters and the nominal P-values based on each statistic's rank,
using optimization algorithms.
A list with the following elements:
chi_mix | vector of -2*log(P)-values. |
scaler | estimated scaling factor for the alternative distribution. |
df_alt | estimated degrees of freedom for the alternative distribution. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.