rolldie: Rolling a Die

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Sets up a sample space for the experiment of rolling a die repeatedly.

Usage

1
rolldie(times, nsides = 6, makespace = FALSE)

Arguments

times

number of rolls.

nsides

number of sides on the die.

makespace

logical.

Details

The function uses expand.grid() to generate all possible rolls resulting from the experiment of rolling a die. Sides on the die are 1:nsides. Columns of the data frame are called X1, X2, up to Xtimes

Value

A data frame, with an equally likely probs column if makespace is TRUE.

Author(s)

G. Jay Kerns gkerns@ysu.edu.

See Also

tosscoin

Examples

1
2
3
rolldie(2)
rolldie(3, nsides = 4)
rolldie(3, nsides = 4, makespace = TRUE)

Example output

Loading required package: combinat

Attaching package: 'combinat'

The following object is masked from 'package:utils':

    combn

Loading required package: fAsianOptions
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics


Rmetrics Package fBasics
Analysing Markets and calculating Basic Statistics
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org
Loading required package: fOptions


Rmetrics Package fOptions
Pricing and Evaluating Basic Options
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org
Loading required package: hypergeo
Loading required package: VGAM
Loading required package: stats4
Loading required package: splines

Attaching package: 'VGAM'

The following object is masked from 'package:hypergeo':

    is.zero

The following object is masked from 'package:fAsianOptions':

    erf


Attaching package: 'prob'

The following objects are masked from 'package:base':

    intersect, setdiff, union

   X1 X2
1   1  1
2   2  1
3   3  1
4   4  1
5   5  1
6   6  1
7   1  2
8   2  2
9   3  2
10  4  2
11  5  2
12  6  2
13  1  3
14  2  3
15  3  3
16  4  3
17  5  3
18  6  3
19  1  4
20  2  4
21  3  4
22  4  4
23  5  4
24  6  4
25  1  5
26  2  5
27  3  5
28  4  5
29  5  5
30  6  5
31  1  6
32  2  6
33  3  6
34  4  6
35  5  6
36  6  6
   X1 X2 X3
1   1  1  1
2   2  1  1
3   3  1  1
4   4  1  1
5   1  2  1
6   2  2  1
7   3  2  1
8   4  2  1
9   1  3  1
10  2  3  1
11  3  3  1
12  4  3  1
13  1  4  1
14  2  4  1
15  3  4  1
16  4  4  1
17  1  1  2
18  2  1  2
19  3  1  2
20  4  1  2
21  1  2  2
22  2  2  2
23  3  2  2
24  4  2  2
25  1  3  2
26  2  3  2
27  3  3  2
28  4  3  2
29  1  4  2
30  2  4  2
31  3  4  2
32  4  4  2
33  1  1  3
34  2  1  3
35  3  1  3
36  4  1  3
37  1  2  3
38  2  2  3
39  3  2  3
40  4  2  3
41  1  3  3
42  2  3  3
43  3  3  3
44  4  3  3
45  1  4  3
46  2  4  3
47  3  4  3
48  4  4  3
49  1  1  4
50  2  1  4
51  3  1  4
52  4  1  4
53  1  2  4
54  2  2  4
55  3  2  4
56  4  2  4
57  1  3  4
58  2  3  4
59  3  3  4
60  4  3  4
61  1  4  4
62  2  4  4
63  3  4  4
64  4  4  4
   X1 X2 X3    probs
1   1  1  1 0.015625
2   2  1  1 0.015625
3   3  1  1 0.015625
4   4  1  1 0.015625
5   1  2  1 0.015625
6   2  2  1 0.015625
7   3  2  1 0.015625
8   4  2  1 0.015625
9   1  3  1 0.015625
10  2  3  1 0.015625
11  3  3  1 0.015625
12  4  3  1 0.015625
13  1  4  1 0.015625
14  2  4  1 0.015625
15  3  4  1 0.015625
16  4  4  1 0.015625
17  1  1  2 0.015625
18  2  1  2 0.015625
19  3  1  2 0.015625
20  4  1  2 0.015625
21  1  2  2 0.015625
22  2  2  2 0.015625
23  3  2  2 0.015625
24  4  2  2 0.015625
25  1  3  2 0.015625
26  2  3  2 0.015625
27  3  3  2 0.015625
28  4  3  2 0.015625
29  1  4  2 0.015625
30  2  4  2 0.015625
31  3  4  2 0.015625
32  4  4  2 0.015625
33  1  1  3 0.015625
34  2  1  3 0.015625
35  3  1  3 0.015625
36  4  1  3 0.015625
37  1  2  3 0.015625
38  2  2  3 0.015625
39  3  2  3 0.015625
40  4  2  3 0.015625
41  1  3  3 0.015625
42  2  3  3 0.015625
43  3  3  3 0.015625
44  4  3  3 0.015625
45  1  4  3 0.015625
46  2  4  3 0.015625
47  3  4  3 0.015625
48  4  4  3 0.015625
49  1  1  4 0.015625
50  2  1  4 0.015625
51  3  1  4 0.015625
52  4  1  4 0.015625
53  1  2  4 0.015625
54  2  2  4 0.015625
55  3  2  4 0.015625
56  4  2  4 0.015625
57  1  3  4 0.015625
58  2  3  4 0.015625
59  3  3  4 0.015625
60  4  3  4 0.015625
61  1  4  4 0.015625
62  2  4  4 0.015625
63  3  4  4 0.015625
64  4  4  4 0.015625

prob documentation built on May 2, 2019, 12:20 p.m.