bayes_total: bayes_total

View source: R/bayes_total.R

bayes_totalR Documentation

bayes_total

Description

Given a set of events it computes the total or conditional probability after Bayes. The events should be R names and the available operators are

Usage

bayes_total(target, partition = NULL, ...)

Arguments

target

character: target event

partition

character: set of events which form a partition

...

numeric: named events with given probabilities

Details

  • ! complementary event,

  • | conditional event, and

  • ^ intersection of events.

The attribute compute of the return value contains the steps for computation.

Value

resulting probability including the steps for computing. If NA is returned then no solution could be found.

Examples

bayes_total('M|T', c("M", "!M"), "M"=0.6, "T|M"=0.75, "T|!M"=0.39, 0.4)
pmt <- bayes_total("M|T", c("M", "!M"), "M"=0.6, "T|M"=0.75, "T|!M"=0.39, 0.4)
cat(paste0(attr(pmt, "compute"), "\n"))
#
bayes_total('A|K', c("A", "B", "C"), "A"=0.55, "B"=0.35, "C"=0.1, "K|A"=0.4, "K|B"=0.1, "K|C"=0.1)
bayes_total('K', c("A", "B", "C"), "A"=0.55, "B"=0.35, "C"=0.1, "K|A"=0.4, "K|B"=0.1, "K|C"=0.1)

sigbertklinke/exams2moodle documentation built on July 6, 2023, 3:26 p.m.