R: Find beta parameters to approximate distribution of p-values.
find.ab
R Documentation
Find beta parameters to approximate distribution of p-values.
Description
Find parameters of a beta distribution to approximate distribution of a p-value derived from a
normal test statistic with one-sided significance level=ALPHA and power=1-BETA.
the number of divisions for the numeric integration used to estimate the mean of p-value distribution, H (see details).
ALPHA
one-sided significance level of normal test statistic
BETA
type II error for normal test stastic
higha
an upper bound on the beta parameter (see details).
Details
The cumulative distribution function of the p-value from a normally distributed test statistic with one-sided significance level=ALPHA
and power=1-BETA is H(p) = 1-pnorm( qnorm(1-p) - qnorm(1-ALPHA)+qnorm(BETA) ).
We approximate this distribution with a beta distribution, B, which has the same mean as H and has B(ALPHA)=1-BETA.
If two beta distributions meet both those criteria, we select the one closest to H in terms of integrated square error
of the cumulative distribution function. That error is estimated by the sample variance of the differences in the two CDFs
evaluated at (0:n)/n. Note that the two beta distributions come from the two roots of the following function:
1-BETA - B(ALPHA)
We search for those two roots as the beta parameter within the range (1/higha, higha).
Value
A list with two elements:
a
numeric value of one of the shape parameters of the beta distribution
b
numeric value of the other shape parameter of the beta distribution
Author(s)
M.P. Fay
References
Fay, M.P., and Follmann, D.A. (2002). "Designing Monte Carlo implementations of
permutation or bootstrap hypothesis tests" American Statistician, 56: 63-70.
Examples
## See first line of Table 1, Fay and Follmann, 2002
find.ab(ALPHA=.05,BETA=.1)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MChtest)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MChtest/find.ab.Rd_%03d_medium.png", width=480, height=480)
> ### Name: find.ab
> ### Title: Find beta parameters to approximate distribution of p-values.
> ### Aliases: find.ab
> ### Keywords: misc
>
> ### ** Examples
>
> ## See first line of Table 1, Fay and Follmann, 2002
> find.ab(ALPHA=.05,BETA=.1)
$a
[1] 0.07705389
$b
[1] 3.923651
>
>
>
>
>
> dev.off()
null device
1
>