Learn R Programming

EMT (version 1.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, showmax = 50)

Arguments

listMultinom

a list created by running the function multinomial.test.

showmax

maximum number of bars to show in the plot (to avoid long tails).

Value

The first argument (listMultinom) is returned without modification.

Details

The function multinomial.test creates an output list that is used as input in plotMultinom to depict some results. If the default approach was used, the figure shows the exact probabilities of all possible outcomes of the experiment. If the Monte Carlo approach was used, the relative frequencies of the outcomes are shown as occurred during the simulated withdrawals. The probabilities/relative frequencies are shown in descending order from the left to the right.

See Also

The Multinomial Distribution: multinomial.test

Examples

Run this code
# NOT RUN {
## 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)        


## Plot the probability distribution:
plotMultinom(out)
plotMultinom(out, showmax = 30)  # suppress part of the tail in the plot 

# }

Run the code above in your browser using DataLab