MyNixOS website logo
Description

Inferring Causal Effects on Collective Outcomes under Interference.

In networks, treatments may spill over from the treated individual to his or her social contacts and outcomes may be contagious over time. Under this setting, causal inference on the collective outcome observed over all network is often of interest. We use chain graph models approximating the projection of the full longitudinal data onto the observed data to identify the causal effect of the intervention on the whole outcome. Justification of such approximation is demonstrated in Ogburn et al. (2018) <arXiv:1812.04990>.

Travis-CI Build Status Downloads badge arXiv shield

Overview

netchain is a R package for causal inference on collective outcomes under social network. Our paper proposed and justified a parsimonious parametrization for social network data generated from causal directed acyclic graph (DAG), approximating a particular family of graphical models known as chain graphs under some conditions.

We provide a function simGibbs() to generate binary outcomes, treatments, and confounders from chain graph model. A function chain.causal.multi() is to infer parameters in the conditional log-linear models that feature hybrid graphical models of undirected graphs and directed acyclic graphs (DAG). This function generates counterfactual outcomes using Gibbs sampling given treatment assignment and the estimated parameters to derive the probability associated with collective outcomes. We also provide a function of causal.influence() to identify the most (causally) influential subjects in social network based on the their causal effect on the collective outcomes.

Package information

Installation

You can download the package by:

install.packages("netchain")

# or you can directly download the development version from author's Github
install.packages("devtools")
library(devtools)
install_github("youjin1207/netchain")

Usage

Here is a R vignettes for guidance. Or you can access to vignettes via:

install_github("youjin1207/netchain", build_vignettes = TRUE)
vignette("chainapprox", package = "netchain")

Example

library(netchain)
# set direct effect and two-way interaction effect on undirected graphs (weight.matrix)
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 = 10, n.sample = 10, 
                   weight.matrix,
                   treat.matrix = 0.5*diag(3), cov.matrix= (-0.3)*diag(3) )
inputY = simobs$inputY
inputA = simobs$inputA
inputC = simobs$inputC

# define relational matrix (R.matrix)
R.matrix = ifelse(weight.matrix==0, 0, 1)      
diag(R.matrix) = 0

# infer conditional log-linear model following chain graph models.
result = chain.causal.multi(targetoutcome = "mean", treatment = c(1,0,0), inputY, inputA, listC = inputC, R.matrix = R.matrix, E.matrix = diag(3), edgeinfo = list(rbind(c("Y", 1), c("C", 1)), rbind(c("Y", 2), c("C", 2)), rbind(c("Y", 3), c("C", 3))), n.obs = 1000, n.burn = 100)
print(result)

# measure influence for each node by evaluating average of collective outcomes under each treatment.
influence = causal.influence(targetoutcome = "mean", Avalues = c(1,0), 
                            inputY, inputA, listC = inputC, R.matrix, E.matrix = diag(3), 
                            edgeinfo = list(rbind(c("Y", 1), c("C", 1)), rbind(c("Y", 2), c("C", 2)), rbind(c("Y", 3), c("C", 3))), n.obs = 100, n.burn = 10)
print(influence)

Reference

Ogburn, E. L., Shpitser, I., & Lee, Y. (2018). Causal inference, social networks, and chain graphs. arXiv preprint arXiv:1812.04990.

Metadata

Version

0.2.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows