Learn R Programming

stCEG (version 0.1.0)

calculate_conditional_prob: Calculate Conditional Probability in a Chain Event Graph (CEG)

Description

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.

Usage

calculate_conditional_prob(
  path_df,
  unique_values,
  selected_indices,
  last_group
)

Value

A numeric value representing the conditional probability P(last_group | unique_values).

Arguments

path_df

A data frame containing paths and their corresponding products, as returned by the calculate_path_products function.

unique_values

A character vector containing the unique values (e.g., labels or categories) to condition on.

selected_indices

A numeric vector of indices corresponding to the groupings of the unique values.

last_group

A string representing the last group for which the conditional probability is to be calculated.