convolution: Add discrete stochastic random variables of arbitrary...

Description Usage Arguments Value Examples

Description

Add discrete stochastic random variables of arbitrary dimensions

Usage

1
convolution(dat, threshold = NA, verbose = F)

Arguments

dat

A data.table with columns 'x', 'y', and 'probabilities'. Column 'x' is a numeric indicator unique for each random variable to be convoluted together. Column 'y' is the outcome value, and colum 'probabilities' contains the probability corresponding to each value of the 'y' column.

threshold

An optional number to set a threshold. If set, the probabilities of all possible outcomes of the sum of the random variables are only caluclated below this value.

verbose

A logical indicator which defaults to FALSE. Set to TRUE to print information.

Value

the convoluted distribution.

Examples

1
2
3
4
convolution(dat = data.table(x = c(rep(1, 2), rep(2, 3), rep(3, 4)), y = c(1:2, 1:3, 1:4), 
    probability = c(3/4, 1/4, rep(1/3, 3), (1:4)/10)))
convolution(dat = data.table(x = c(rep(1, 2), rep(2, 3), rep(3, 4)), y = c(1:2, 1:3, 1:4), 
    probability = c(3/4, 1/4, rep(1/3, 3), (1:4)/10)), threshold = 6)

MaleneJuul/ncdDetectTools documentation built on May 8, 2019, 3:24 p.m.