cond_prob: Conditional probability calculator.

Description Usage Arguments Value Note Author(s) Examples

View source: R/cond_prob.R

Description

Calculates conditional probabilities using co-occurrences using Bayes' Theorem, such that P(A|B) = \frac{P(A,B)}{P(B)}, where P(A,B) = \frac{(A,B)}{N}, P(B) = \frac{(B)}{N} and N is the total number of observational units.

Usage

1
cond_prob(a, b)

Arguments

a

A set of repeated observations of occurrences.

b

Another set of repeated observations of occurrences.

Value

Returns the conditional probabilities.

Note

This is primarily a low-level function used by coNet, it may be of interest to more advanced users.

Author(s)

Matthew K. Lau

Examples

1
2
3
4
5
6
7
8
A <- c(1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1)
B <- c(1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1)
cond_prob(A, B)

C <- c(1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1)
D <- c(0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0)

cond_prob(C, D)

ECGen/coNet documentation built on Sept. 14, 2019, 5:24 a.m.