Learn R Programming

EMT (version 1.3.1)

plotMultinom: Plot the Probability distribution fot the Exact Multinomial Test

Description

This function takes the results of multinomial.test as input and plots the calculated probability distribution.

Usage

plotMultinom(listMultinom)

Value

The first argument (listMultinom) is returned without modification.

Arguments

listMultinom

a list created by running the function multinomial.test.

Author

Uwe Menzel <uwemenzel@gmail.com>

Details

The function plotMultinom displays a barplot of the probabilities for the individual events. The probabilities are shown in descending order from the left to the right. Events contributing to the p-value are marked red. Plots are only made if the number of different events is lower than or equal to 100 and for low number of trials in Monte Carlo simulations.

See Also

The Multinomial Distribution: multinomial.test

Examples

Run this code

## Load the EMT package:
library(EMT)

## input and calculation of p-values:
observed <- c(5,2,1)   		
prob <- c(0.25, 0.5, 0.25) 
out <- multinomial.test(observed, prob)     # p.value = 0.0767

## Plot the probability distribution:
plotMultinom(out)

Run the code above in your browser using DataLab