dice: Theoretical Probability Distribution of Rolling Dice

Description Usage Arguments Details Value Examples

Description

Mean and probability of rolling fair or loaded dice

Usage

1
dice(n, prob = NULL)

Arguments

n

number of trials

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 possible outcomes.

Examples

1
2
dice(n = 4)
dice(2, c(0.1, 0.2, 0.2, 0.1, 0.3, 0.1))

Example output

   MEAN_VALUE  PROBABILITY
1        1.00 0.0007716049
2        1.25 0.0030864198
3        1.50 0.0077160494
4        1.75 0.0154320988
5        2.00 0.0270061728
6        2.25 0.0432098765
7        2.50 0.0617283951
8        2.75 0.0802469136
9        3.00 0.0964506173
10       3.25 0.1080246914
11       3.50 0.1126543210
12       3.75 0.1080246914
13       4.00 0.0964506173
14       4.25 0.0802469136
15       4.50 0.0617283951
16       4.75 0.0432098765
17       5.00 0.0270061728
18       5.25 0.0154320988
19       5.50 0.0077160494
20       5.75 0.0030864198
21       6.00 0.0007716049
   MEAN_VALUE PROBABILITY
1         1.0        0.01
2         1.5        0.04
3         2.0        0.08
4         2.5        0.10
5         3.0        0.14
6         3.5        0.18
7         4.0        0.17
8         4.5        0.10
9         5.0        0.11
10        5.5        0.06
11        6.0        0.01

clttools documentation built on May 2, 2019, 9:17 a.m.

Related to dice in clttools...