dice.simu: Probability Distribution of Simulated Dice Rolling

Description Usage Arguments Details Value Examples

View source: R/clttools.R

Description

Mean and probabilityf of flipping fair or loaded dice

Usage

1
dice.simu(n, times, prob = NULL)

Arguments

n

number of trials in one simulation

times

number of simulations

prob

probability assigned to each possible outcome

Details

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

Value

Mean value and corresponding probabilities for all simulated outcomes.

Examples

1
2
dice.simu(n = 4, times = 1000)
dice.simu(4, 1000, prob = c(0.3, 0.1, 0.1, 0.1, 0.3, 0.1))

Example output

     MEAN_VALUE FREQUENCY PROBABILITY
1          1.00         2       0.002
1.25       1.25         1       0.001
1.5        1.50         1       0.001
1.75       1.75        14       0.014
2          2.00        26       0.026
2.25       2.25        49       0.049
2.5        2.50        79       0.079
2.75       2.75        79       0.079
3          3.00        90       0.090
3.25       3.25       113       0.113
3.5        3.50       106       0.106
3.75       3.75       110       0.110
4          4.00        97       0.097
4.25       4.25        77       0.077
4.5        4.50        62       0.062
4.75       4.75        47       0.047
5          5.00        29       0.029
5.25       5.25         7       0.007
5.5        5.50         8       0.008
5.75       5.75         3       0.003
     MEAN_VALUE FREQUENCY PROBABILITY
1          1.00        10       0.010
1.25       1.25        14       0.014
1.5        1.50        20       0.020
1.75       1.75        17       0.017
2          2.00        47       0.047
2.25       2.25        52       0.052
2.5        2.50        71       0.071
2.75       2.75        62       0.062
3          3.00       126       0.126
3.25       3.25       106       0.106
3.5        3.50       103       0.103
3.75       3.75        83       0.083
4          4.00        78       0.078
4.25       4.25        82       0.082
4.5        4.50        48       0.048
4.75       4.75        31       0.031
5          5.00        27       0.027
5.25       5.25        18       0.018
5.5        5.50         3       0.003
5.75       5.75         2       0.002

clttools documentation built on May 29, 2017, 11:43 p.m.

Related to dice.simu in clttools...