causal.influence: Identifying causally influential units on social network

Description Usage Arguments Value Author(s) Examples

View source: R/influence.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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"
)

Arguments

targetoutcome

is a targeted couterfactual outcome of probability is in our interest, having different forms depending on the context of influence :

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

Avalues

distinct treatment values of which maximum indicates intervention. Defaults to (0,1).

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 :

influence
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 <- causal.influence(targetoutcome = "mean", Avalues = c(1,0), inputY, inputA, 
# listC = inputC, R.matrix, E.matrix = diag(3), edgeinfo = edgeinfo)   

netchain documentation built on Feb. 17, 2020, 9:11 a.m.