proptest_num {exams.forge} | R Documentation |
Proportion Tests
Description
Computes all results for test on proportion using either stats::binom.test()
, or
a normal approximation without continuity correction.
Either named parameters can be given or an arglist
with the following parameters:
-
x
number of successes -
n
sample size (default:sd(x)
) -
pi0
true value of the proportion (default:0.5
) -
alternative
a string specifying the alternative hypothesis (default:"two.sided"
), otherwise"greater"
or"less"
can be used -
alpha
significance level (default:0.05
) -
binom2norm
can the binomial distribution be approximated by a normal distribution? (default:NA
= usebinom2norm
function)
Usage
proptest_num(..., arglist = NULL)
prop_binomtest_num(..., arglist = NULL)
nbinomtest(..., arglist = NULL)
Arguments
... |
named input parameters |
arglist |
list: named input parameters, if given |
Details
The results of proptest_num
may differ from stats::binom.test()
. proptest_num
is designed to return results
when you compute a binomial test by hand. For example, for computing the test statistic the approximation
is used if
. The
p.value
is computed by stats::binom.test and may not be reliable, for Details see Note!
Value
A list with the input parameters and the following:
-
X
distribution of the random sampling function -
Statistic
distribution of the test statistics -
statistic
test value -
critical
critical value(s) -
criticalx
critical value(s) in x range -
acceptance0
acceptance interval for H0 -
acceptance0x
acceptance interval for H0 in x range -
accept1
is H1 accepted? -
p.value
p value for test (note: the p-value may not be reliable see Notes!) -
alphaexact
exact significance level -
stderr
standard error of the proportion used as denominator
Note
The computation of a p-value for non-symmetric distribution is not well defined, see https://stats.stackexchange.com/questions/140107/p-value-in-a-two-tail-test-with-asymmetric-null-distribution.
Examples
n <- 100
x <- sum(runif(n)<0.4)
proptest_num(x=x, n=n)