causal.influence {netchain} | R Documentation |
This function calculates probability associated with counterfactual collective outcome(s)
P(Y(a_j) = y) as a measure of influence of unit j
,
where a_j indicates the sole intervention of unit j
.
causal.influence(targetoutcome = "mean", Avalues, inputY, inputA, listC, R.matrix, E.matrix, edgeinfo = NULL, n.obs = 1000, n.burn = 100, optim.method = "L-BFGS-B")
targetoutcome |
is a targeted couterfactual outcome of probability is in our interest, having different forms depending on the context of influence :
|
Avalues |
distinct treatment values of which maximum indicates intervention. Defaults to |
inputY |
a |
inputA |
a |
listC |
is either a matrix, list or
|
R.matrix |
a |
E.matrix |
a |
edgeinfo |
a list of matrix specifying additional directed edges (from confounders or treatment to the outcomes) information. Defaults to
|
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 |
returns "noconvergence"
in case of failure to converence or a list with components :
|
|
|
the number of parameters estimated in conditional log-linear model. |
|
the estimated parameters. |
Youjin Lee
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 <- causal.influence(targetoutcome = "mean", Avalues = c(1,0), inputY, inputA, # listC = inputC, R.matrix, E.matrix = diag(3), edgeinfo = edgeinfo)