# prob: Probability and Conditional Probability In prob: Elementary Probability on Finite Sample Spaces

## Description

Calculates probability and conditional probability of events.

## Usage

 ```1 2 3 4 5 6 7``` ```Prob(x, ...) ## Default S3 method: Prob(x, event = NULL, given = NULL, ...) ## S3 method for class 'ps' Prob(x, event = NULL, given = NULL, ...) ```

## Arguments

 `x` a probability space or a subset of one. `event` logical expression indicating elements or rows of `space` to keep: missing values are taken as false. `given` either a subset of a probability space or a logical expression indicating elements or rows of `space` to keep: missing values are taken as false. `...` further arguments to be passed to or from other methods.

## Details

This function calculates the probability of events or subsets of a given sample space. Conditional probability is also implemented. In essence, the `Prob()` function operates by summing the `probs` column of its argument. It will find subsets on the fly if desired.

The `event` argument is used to define a subset of `x`, that is, the only outcomes used in the probability calculation will be those that are elements of `x` and satisfy `event` simultaneously. In other words, `Prob(x,event)` calculates `Prob(intersect(x, subset(x, event)))`. Consequently, `x` should be the entire probability space in the case that `event` is non-null.

There is some flexibility in the `given` argument in that it can be either a data frame or it can be a logical expression that defines the subset. However, that flexibility is limited. In particular, if `given` is a logical expression, then `event` must also be specified (also a logical expression). And in this case, the argument `x` should be the entire sample space, not a subset thereof.

## Value

A number in the interval `[0,1]`.

## Author(s)

G. Jay Kerns [email protected].

`probspace`, `iidspace`
 ```1 2 3``` ```S <- rolldie(times = 3, makespace = TRUE ) Prob(S, X1+X2 > 9 ) Prob(S, X1+X2 > 9, given = X1+X2+X3 > 7 ) ```