interventionTable: Calculate interventional distributions.

interventionMatrixR Documentation

Calculate interventional distributions.

Description

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

Usage

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

interventionTable(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.

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().

Value

A numerical array of the same dimension as x.

Functions

  • interventionMatrix: Interventions in matrix of distributions

Author(s)

Robin Evans

References

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

See Also

conditionTable, marginTable

Examples


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)


rje documentation built on Nov. 12, 2022, 9:06 a.m.