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.

Please suggest features or report bugs with the GitHub issue tracker.

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.