Learn R Programming

pcalg (version 2.0-3)

mat2targets: Construct a list of intervention targets and a target index vector

Description

This function constructs a list of intervention targets and a corresponding vector of target indices from a matrix specifying intervened vertices. The input matrix has the same dimensions as the usual data matrix; the output can be used to create scoring objects (see Score) and to run causal inference methods based on interventional data such as gies or simy.

Usage

mat2targets(A)

Arguments

A
Logical matrix with $n$ rows and $p$ columns, where $n$ is the sample size of a data set with jointly interventional and observational data, and $p$ is the number of variables. A[i, j] is TRUE iff variable j

Value

  • mat2targets returns a list with two components:
  • targetsA list of unique intervention targets.
  • target.indexA vector of intervention target indices. The intervention target of data point i is encoded as targets[[target.index[i]]].

encoding

UTF-8

concept

  • intervention
  • interventional data

See Also

Score, gies, simy

Examples

Run this code
## Specify interventions using a matrix
p <- 5
n <- 10
A <- matrix(FALSE, nrow = n, ncol = p)
for (i in 1:n) A[i, (i-1) %% p + 1] <- TRUE

## Generate list of intervention targets and corresponding indices
target.list <- mat2targets(A)

for (i in 1:length(target.list$target.index))
  sprintf("Intervention target of %d-th data point: %d", 
    i, target.list$targets[[target.list$target.index[i]]])

Run the code above in your browser using DataLab