Check if dist is properly specified for use with sim.q, exact.q

1 |

`dist` |
list of two numeric vectors |

Several functions deal with computing a probability

*P(X_1 X_2 \cdots X_n > t),*

where *X_1,…,X_n* are non-negative discrete random variables. The function `exact.q`

computes this probability by explicitly evaluating the sum, while `sim.q`

estimates the probability using importance sampling. An exact approach that can handle relatively large problems is the use of `dists.product.pair`

and `dist.pair.cdf`

. All functions require the distributions of the *X_i*'s to be specified as a list with of two numeric vectors `x`

and `fx`

, where `x`

denotes the outcomes and `fx`

the probabilities. The outcomes should be non-negative. Only the first outcome can be 0 and only the last outcome can be Inf. The current function checks whether the distribution is properly specified.

list the supplied `dist`

.

1 2 3 4 5 6 7 8 9 10 | ```
# proper specification
dist <- list(x=c(1,2,3),fx=c(1/3,1/3,1/3))
check.dist(dist) # fine
# duplicates are not allowed
dist1 <- list(x=c(1,2,2),fx=c(0.1,0.2,0.7))
#check.dist(dist1) # would throw an error
# remove the duplicate
dist1 <- dist.unique.events(dist1)
check.dist(dist1) # fine
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.