check_sum_probs: Check sum probabilities

View source: R/fct_inspection.R

check_sum_probsR Documentation

Check sum probabilities

Description

This function checks whether the sum of user-defined variables representing probabilities is below or equal to 1 for each iteration of the probabilistic inputs.

Usage

check_sum_probs(..., df, digits = NULL, check = "lower", max_view = 100)

Arguments

...

character vector. This character vector contains the name of the variables of which the sum will be checked.

df

a dataframe.

digits

numeric. Define the number of digits at which the sum of probabilities should be rounded.

check

logical. Define which test to perform."lower" tests whether the sum of the selected variables is lower than or equal to 1 for each iteration. "equal" tests whether the sum of the selected variables is equal to 1 for each iteration. Default is "lower".

max_view

numeric. Determines the number of iterations to display which do not fulfill the test Default is 100.

Value

A text indicating whether the sum of the probabilities is belor and/or eual to one or indicating in which iteration that is not the case.

Examples

# Checking whether the sum of the two probabilities is lower than or equal to 1
check_sum_probs("p_pfspd", "p_pfsd", df = df_pa, check = "lower")

# Checking the sum of the two probabilities equals 1 using a vector to select them,
# Rounding off to two digits, and extending the number of iterations to display to 250.
check_sum_probs(c("p_pfspd", "p_pfsd"), df = df_pa, digits = 2, check = "equal", max_view = 250)

Xa4P/pacheck documentation built on April 14, 2025, 1:51 p.m.