Last data update: 2014.03.03

R: Exact multinomial test
multinomial.testR Documentation

Exact multinomial test

Description

Perfoms an exact multinomial test on a vector of counts.

Usage

multinomial.test(x, p = rep(1/length(x), length(x)))

Arguments

x

numeric vector (counts).

p

theoretical proportions (optional).

Details

The function works as chisq.test or G.test :

- if theoretical proportions are not given, equality of counts is tested

- if theoretical proportions are given, equality of counts to theoretical counts (given by theoretical proportions) is tested.

Since chi-squared and G tests are approximate tests, exact tests are preferable when the number of individuals is small (200 is a reasonable minimum).

Be aware that the calculation time increases with the number of individuals (i.e. the sum of x) and the number of groups (i.e. the length of x).

An exact multinomial test with two groups is strictly the same as an exact binomial test.

Value

method

name of the test.

p.value

p-value.

data.name

a character string giving the name(s) of the data.

observed

the observed counts.

expected

the expected counts under the null hypothesis.

Author(s)

Maxime Herv<c3><a9> <mx.herve@gmail.com> based on multinomial.test

See Also

chisq.test, G.test, binom.test, multinomial.multcomp, multinomial.theo.multcomp

Examples

counts <- c(5,15,23)
multinomial.test(counts)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RVAideMemoire)
*** Package RVAideMemoire v 0.9-56 ***
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RVAideMemoire/multinomial.test.Rd_%03d_medium.png", width=480, height=480)
> ### Name: multinomial.test
> ### Title: Exact multinomial test
> ### Aliases: multinomial.test
> 
> ### ** Examples
> 
> counts <- c(5,15,23)
> multinomial.test(counts)

	Exact multinomial test

data:  counts
p-value = 0.002187

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>