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

Description Usage Arguments Details Value Examples

Description

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

Usage

1

Arguments

dist

list of two numeric vectors x and fx: x lists the outcomes and fx the probabilities

Details

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.

Value

list the supplied dist.

Examples

 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

DNAprofiles documentation built on Jan. 15, 2017, 9:27 p.m.