Description Usage Arguments Value Author(s) Examples
View source: R/generaleffect.R
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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"
)
|
targetoutcome |
is a targeted couterfactual outcome of probability is in our interest, having different forms:
|
treatment |
a vector of length |
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 estimated probability P(Y(a) = y). |
|
the number of parameters estimated in conditional log-linear model. |
|
the estimated parameters. |
Youjin Lee
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.