Learn R Programming

clttools (version 1.3)

coin.simu: Probability Distribution of Simulated Coins Flipping

Description

Mean and probability plot of flipping fair or loaded coin

Usage

coin.simu(n, times, prob = NULL)

Arguments

n
number of trials in one simulation
times
number of simulations
prob
probability assigned to each possible outcome

Value

Mean value and corresponding probabilities for all simulated outcomes.

Details

The default probabilty equals to 1/n. All the assigned probabilites must between 0 and 1.

Examples

Run this code
coin.simu(n = 4, times = 1000)
coin.simu(4, 1000, prob = c(0.3, 0.7))

Run the code above in your browser using DataLab