bayesComputeMarginalFactor {mmb} | R Documentation |
Compute a marginal factor (continuous or discrete random variable).
Description
Computes the probability (discrete feature) or relative likelihood (continuous feature) of one given feature and a concrete value for it.
Usage
bayesComputeMarginalFactor(df, feature, doEcdf = FALSE)
Arguments
df |
data.frame that contains all the feature's data |
feature |
data.frame containing the designated feature as created
by @seealso |
doEcdf |
default FALSE a boolean to indicate whether to use the empirical CDF to return a probability when inferencing a continuous feature. If false, uses the empirical PDF to return the rel. likelihood. This parameter does not have any effect when inferring discrete values. Using the ECDF, a probability to find a value less than or equal to the given value is returned. |
Value
numeric the probability or likelihood of the given feature assuming its given value.
Author(s)
Sebastian Hönel sebastian.honel@lnu.se
Examples
feat <- mmb::createFeatureForBayes(
name = "Petal.Length", value = mean(iris$Petal.Length))
mmb::bayesComputeMarginalFactor(df = iris, feature = feat)
mmb::bayesComputeMarginalFactor(df = iris, feature = feat, doEcdf = TRUE)