Testing for Network Dependence

When network dependence is present, that is when social relations can engender dependence in the outcome of interest, treating such observations as independent results in invalid, anti-conservative statistical inference. We propose a test of independence among observations sampled from a single network .

Build Status

netdep is for testing for network dependence. Dependence due to social network connections increases variance and engenders confounding that can lead to biased estimates. Therefore testing for network dependence should precede any statistical inference upon observations sampled from a single or small number of social networks. We also provide two data generative process for generating network dependent outcomes--network dependence due to (1) direct transmission and (2) latent variable dependence.

Package information


You can download the package by:


# or you can directly download the development version from author's Github 


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

vignette("nettest", package = "netdep")



# generate network
G = latent.netdep(n.node = 200, rho = 0.2, dep.factor = -1)
A = as.matrix(get.adjacency(G))
outcomes = peer.process(A, max.time = 3, mprob = 0.6, epsilon = 0.1)
result3 = make.permute.moran(A, outcomes$time3, np = 100)
# generate latent variable dependent observations
G = latent.netdep(n.node = 200, rho = 0.4, dep.factor = -1)
subG = snowball.sampling(G, 100)$subG
A = as.matrix(get.adjacency(subG))

# transform continuous observations to categorical observations
conti.Y = V(subG)$outcome 
cate.Y = ifelse(conti.Y < quantile(conti.Y, 0.25), 1, 4)
cate.Y = ifelse(conti.Y < quantile(conti.Y, 0.60) & conti.Y >= quantile(conti.Y, 0.25), 2, cate.Y)
cate.Y = ifelse(conti.Y < quantile(conti.Y, 0.80) & conti.Y >= quantile(conti.Y, 0.60), 3, cate.Y)

# apply network dependence for categorical variable
result = make.permute.Phi(A, cate.Y, 100)


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.0 by Youjin Lee, 3 years ago

Browse source code at https://github.com/cran/netdep

Authors: Youjin Lee [aut, cre] , Elizabeth Ogburn [aut]

Documentation:   PDF Manual  

GPL (>= 3) | file LICENSE license

Imports stats, igraph, igraphdata, MASS, mvrtn

Suggests knitr, testthat

See at CRAN