Check if the given .data is a distribution and normalise it if necessary with an optional Laplace correction.
check_distribution(
.data,
.do.norm = NA,
.laplace = 1,
.na.val = 0,
.warn.zero = FALSE,
.warn.sum = TRUE
)
Numeric vector of values.
One of the three values - NA, TRUE or FALSE. If NA then checks for distrubution (sum(.data) == 1) and normalises if needed with the given laplace correction value. if TRUE then does the normalisation and laplace correction. If FALSE then doesn't do either normalisaton or laplace correction.
Value for the laplace correction.
Replace all NAs with this value.
if TRUE then the function checks if in the resulted vector (after normalisation) are any zeros, and prints a warning message if there are some.
if TRUE then the function checks if the sum of resulted vector (after normalisation) is equal to one, and prints a warning message if not.
Numeric vector.
immunarch:::check_distribution(c(1, 2, 3)) immunarch:::check_distribution(c(1, 2, 3), TRUE) immunarch:::check_distribution(c(1, 2, 3), FALSE)