This function calculates the conditional probability of a specified group of conditions occurring, given a set of unique values, based on the calculated path products.
calculate_conditional_prob(
path_df,
unique_values,
selected_indices,
last_group
)
A numeric value representing the conditional probability P(last_group | unique_values).
A data frame containing paths and their corresponding products,
as returned by the calculate_path_products
function.
A character vector containing the unique values (e.g., labels or categories) to condition on.
A numeric vector of indices corresponding to the groupings of the unique values.
A string representing the last group for which the conditional probability is to be calculated.