Learn R Programming

exams.forge (version 1.0.10)

proptest_num: 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 = use binom2norm function)

Usage

proptest_num(..., arglist = NULL)

prop_binomtest_num(..., arglist = NULL)

nbinomtest(..., arglist = NULL)

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

Arguments

...

named input parameters

arglist

list: named input parameters, if given ... will be ignored

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!

Examples

Run this code
n <- 100
x <- sum(runif(n)<0.4)
proptest_num(x=x, n=n)

Run the code above in your browser using DataLab