Learn R Programming

rje (version 1.9)

interventionTable: Calculate interventional distributions.

Description

Calculate interventional distributions from a probability table or matrix of multivariate probability distributions.

Usage

interventionTable(x, variables, condition)
interventionMatrix(x, variables, condition, dim=NULL, incols=FALSE)

intervention.table(x, variables, condition)

Arguments

x

An array of probabilities.

variables

The margin for the intervention.

condition

The dimensions to be conditioned upon.

dim

Integer vector containing dimensions of variables. Assumed all binary if not specified.

incols

Logical specifying whether not the distributions are stored as the columns in the matrix; assumed to be rows by default.

Value

A numerical array of the same dimension as \(x\).

Details

This just divides the joint distribution \(p(x)\) by \(p(v | c)\), where \(v\) is variables and \(c\) is condition.

Under certain causal assumptions this is the interventional distribution \(p(x \,|\, do(v))\) (i.e. if the direct causes of \(v\) are precisely \(c\).)

intervention.table() is identical to interventionTable().

References

Pearl, J., Causality, 2nd Edition. Cambridge University Press, 2009.

See Also

conditionTable, marginTable

Examples

Run this code
# NOT RUN {
set.seed(413)
# matrix of distributions
p = rdirichlet(10, rep(1,16))
interventionMatrix(p, 3, 2)

# take one in an array
ap = array(p[1,], rep(2,4))
interventionTable(ap, 3, 2)
# }

Run the code above in your browser using DataLab