Skip to contents

Computes a Wald interval for a proportion at a desired level of significance.

Usage

confidence_multinomial(object, ...)

# S4 method for class 'numeric'
confidence_multinomial(
  object,
  level = 0.95,
  method = "wald",
  corrected = FALSE
)

Arguments

object

A numeric vector of positive integers giving the number of occurrences of each class.

...

Currently not used.

level

A length-one numeric vector giving the confidence level. Must be a single number between \(0\) and \(1\).

method

A character string specifying the method to be used. Any unambiguous substring can be used.

corrected

A logical scalar: should continuity correction be used? Only used if method is "wald".

Value

A two column numeric matrix giving the lower and upper confidence limits.

See also

Author

N. Frerebeau

Examples

## Confidence interval for a mean
x <- seq(from = -4, to = 4, by = 0.01)
y <- dnorm(x)

confidence_mean(y, type = "student")
#>     lower     upper 
#> 0.1151118 0.1345606 
confidence_mean(y, type = "normal")
#>     lower     upper 
#> 0.1151265 0.1345459 

## Confidence interval for a propotion
confidence_binomial(118, n = 236)
#>     lower     upper 
#> 0.4362086 0.5637914 

x <- c(35, 74, 22, 69)
confidence_multinomial(x)
#>           lower     upper
#> [1,] 0.12234021 0.2276598
#> [2,] 0.30308797 0.4369120
#> [3,] 0.06663649 0.1533635
#> [4,] 0.27911853 0.4108815