chain.causal.multi: Causal estimation on collective outcomes under multiple...

Description Usage Arguments Value Author(s) Examples

Description

This function calculates probability associated with counterfactual collective outcome(s) P(Y(a) = y) when m units are subject to interference and contagion possibly with the presence of multiple confounders. To estimate the magnitude of main effects, two-way interaction effects, or any higher-order interaction effects we use hybrid graphcial models combining features of both log-linear models on undirected graphs (R.matrix) and directed acyclic graphs (DAGs) models used to represent casual relationships.

Usage

1
2
3
chain.causal.multi(targetoutcome = "mean", treatment, inputY, inputA,
  listC, R.matrix, E.matrix, edgeinfo = NULL, n.obs = 1000,
  n.burn = 100, optim.method = "L-BFGS-B")

Arguments

targetoutcome

is a targeted couterfactual outcome of probability is in our interest, having different forms:

a vector of length m

a vector specifies every element of y.

a [q x m] matrix

a collection of y_1, y_2, ..., y_q of which we want to derive the probability.

an integer

the number of 1's in y (0 ≥ & ≤ m).

'mean'

when we want derive E(Y(a)) (default).

treatment

a vector of length m representing given treatment assignment a.

inputY

a [n x m] matrix of n independent outcomes for m units.

inputA

a [n x m] matrix of n independent treatment assignments assigned to m units.

listC

is either a matrix, list or NULL:

a [n x m] matrix

a matrix of n independent confounders for m units under single confounder.

a list of [n x m] matrices

a collection of n independent confounders for m units under multiple confounders.

NULL

no confounders.

R.matrix

a [m x m] relational symmetric matrix where R.matrix_ij = 1 indicates Y_i and Y_j are adjacent.

E.matrix

a [m x m] matrix where E.matrix_ij = 1 indicates A_i has a direct causal effect on Y_j. Defaults to diagonal matrix, which indicates no interference.

edgeinfo

a list of matrix specifying additional directed edges (from confounders or treatment to the outcomes) information. Defaults to NULL.

first column:

"Y" indicates outcomes; "A" indicates treatment; "C" indicates confounders. Under multiple confounders, "C1", "C2", ... indicate each confounder.

second column:

an index for unit corresponding to the variable in the first column, i=1,2,...m.

n.obs

the number of Gibbs samplers except for burn-in sample.

n.burn

the number of burn-in sample in Gibbs sampling.

optim.method

the method used in optim(). Defaults to "L-BFGS-B".

Value

returns "noconvergence" in case of failure to converence or a list with components :

causalprob

the estimated probability P(Y(a) = y).

n.par

the number of parameters estimated in conditional log-linear model.

par.est

the estimated parameters.

Author(s)

Youjin Lee

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(netchain)
set.seed(1234)
weight.matrix <- matrix(c(0.5, 1, 0, 1, 0.3, 0.5, 0, 0.5, -0.5), 3, 3)
simobs <- simGibbs(n.unit = 3, n.gibbs = 100, n.sample = 5, 
                  weight.matrix, treat.matrix = 0.5*diag(3), cov.matrix= (-0.3)*diag(3) )
inputY <- simobs$inputY                   
inputA <- simobs$inputA   
inputC <- simobs$inputC 
R.matrix <- ifelse(weight.matrix==0, 0, 1)    
diag(R.matrix) <- 0
edgeinfo <- list(rbind(c("Y", 1), c("C", 1)), rbind(c("Y", 2), c("C", 2)), 
           rbind(c("Y", 3), c("C", 3)))  
# implement a function (take > 10 seconds)
# result <- chain.causal.multi(targetoutcome = "mean",
# treatment <- c(1,0,0), inputY, inputA, listC = inputC, R.matrix, 
# E.matrix <- diag(3), edgeinfo = edgeinfo)

youjin1207/netchain documentation built on May 7, 2019, 9:32 a.m.