multitrial: Multinomial Trial Simulation

Description Usage Arguments Details Value References See Also Examples

Description

Computes the result of a random multinomial trial based on the inputted probability of outcome for each k level.

Usage

1

Arguments

p

A vector containing the probability of outcome for k levels of a random multinomial trial

Details

An illustration of this function's use can be found in Exercise 3.1.19 on page 165.

Value

multitrial contains the outcome of one event for a random multinomial trial.

References

Hogg, R., McKean, J., Craig, A. (2018) Introduction to Mathematical Statistics, 8th Ed. Boston: Pearson.

See Also

psum() for ...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ps <- c(0.3, 0.2, 0.2, 0.2, 0.1)

# Performing 10 random trials if ps <- c(0.3, 0.2, 0.2, 0.2, 0.1)
trials <- 1:10
result <- rep(0, length(trials))

for (i in 1:length(trials)) {
    result[i] <- multitrial(ps)
}

# Result of 10 random trials
result

austinragotzy/mathstat documentation built on May 13, 2019, 11:30 a.m.