marginal: Marginal Distributions

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

Description

Computes the marginal distribution of a set of variables.

Usage

1
marginal(space, vars = NULL)

Arguments

space

a data frame probability space or a subset of one.

vars

an optional character vector of variable names in space.

Details

If vars is not specified, then marginal() will set vars to be all non-probs columns, which can be useful in the case that it is desired to aggregate duplicated rows.

Value

A data frame with a probs column.

Author(s)

G. Jay Kerns gkerns@ysu.edu.

See Also

See addrv for adding random variables to a data frame probability space.

Examples

1
2
S <- rolldie(3, makespace = TRUE)
marginal(S, vars = c("X1", "X2"))

Example output

Loading required package: combinat

Attaching package:combinatThe following object is masked frompackage:utils:

    combn

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

Attaching package:probThe following objects are masked frompackage:base:

    intersect, setdiff, union

   X1 X2      probs
1   1  1 0.02777778
2   2  1 0.02777778
3   3  1 0.02777778
4   4  1 0.02777778
5   5  1 0.02777778
6   6  1 0.02777778
7   1  2 0.02777778
8   2  2 0.02777778
9   3  2 0.02777778
10  4  2 0.02777778
11  5  2 0.02777778
12  6  2 0.02777778
13  1  3 0.02777778
14  2  3 0.02777778
15  3  3 0.02777778
16  4  3 0.02777778
17  5  3 0.02777778
18  6  3 0.02777778
19  1  4 0.02777778
20  2  4 0.02777778
21  3  4 0.02777778
22  4  4 0.02777778
23  5  4 0.02777778
24  6  4 0.02777778
25  1  5 0.02777778
26  2  5 0.02777778
27  3  5 0.02777778
28  4  5 0.02777778
29  5  5 0.02777778
30  6  5 0.02777778
31  1  6 0.02777778
32  2  6 0.02777778
33  3  6 0.02777778
34  4  6 0.02777778
35  5  6 0.02777778
36  6  6 0.02777778

prob documentation built on May 2, 2019, 6:11 p.m.