Learn R Programming

exams.forge (version 1.0.11)

t2norm: Distribution Approximations

Description

These functions check whether a normal approximation is appropriate for a given distribution. They return TRUE if the approximation condition is met, and FALSE otherwise. The threshold parameter c can be set directly or retrieved via getOption().

The functions apply the following rules:

  • t2norm: n > c with default c = 30.

  • binom2norm:

    • If type = "single" (default), the approximation is valid if size × prob × (1 - prob) > c.

    • If type = "double", the approximation requires both size × prob > c and size × (1 - prob) > c, with default c = 9.

  • clt2norm: n > c with default c = 30. Note that the existence of expectation and variance, required by the Central Limit Theorem, cannot be checked automatically.

Usage

t2norm(n, c = getOption("distribution.t2norm", 30))

binom2norm( size, prob, c = getOption("distribution.binom2norm", 9), type = c("single", "double") )

clt2norm(n, c = getOption("distribution.clt2norm", 30))

approx_binom2norm( size, prob, c = getOption("distribution.binom2norm", 9), type = c("single", "double") )

approx_clt2norm(n, c = getOption("distribution.clt2norm", 30))

approx_t2norm(n, c = getOption("distribution.t2norm", 30))

Value

logical: TRUE if the approximation is valid, FALSE otherwise

Arguments

n

integer: number of observations (for t2norm and clt2norm)

c

numeric: threshold parameter for approximation (default via getOption() or a default value)

size

integer: number of trials (for binom2norm)

prob

numeric: probability of success on each trial (for binom2norm)

type

character: approximation type, "single" or "double" (for binom2norm)

Examples

Run this code
# Check for 5 and 50 observations
t2norm(n = c(5, 50))
binom2norm(size = c(5, 50), prob = 0.5)
binom2norm(size = c(5, 50), prob = 0.5, type = "double")

Run the code above in your browser using DataLab