| 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:
-
xnumber of successes -
nsample size (default:sd(x)) -
pi0true value of the proportion (default:0.5) -
alternativea string specifying the alternative hypothesis (default:"two.sided"), otherwise"greater"or"less"can be used -
alphasignificance level (default:0.05) -
binom2normcan the binomial distribution be approximated by a normal distribution? (default:NA= usebinom2normfunction)
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 t_n \approx N(0; 1)
is used if n>n.tapprox. 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:
-
Xdistribution of the random sampling function -
Statisticdistribution of the test statistics -
statistictest value -
criticalcritical value(s) -
criticalxcritical value(s) in x range -
acceptance0acceptance interval for H0 -
acceptance0xacceptance interval for H0 in x range -
accept1is H1 accepted? -
p.valuep value for test (note: the p-value may not be reliable see Notes!) -
alphaexactexact significance level -
stderrstandard 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)