R package for Bayesian Analysis of the Network Autocorrelation Model. The methodology is based on:
Dittrich, D., Leenders, R.Th.A.J., & Mulder, J. (2017). Bayesian estimation of the network autocorrelation model. Social Network, 48, 213–236. doi:10.1016/j.socnet.2016.09.002
Dittrich, D., Leenders, R.Th.A.J., & Mulder, J. (2019). Network autocorrelation modeling: A Bayes factor approach for testing (multiple) precise and interval hypotheses. Sociological Methods & Research, 48, 642-676. doi:10.1177/0049124117729712
Dittrich, D., Leenders, R.Th.A.J., & Mulder, J. (2020). Network Autocorrelation Modeling: Bayesian Techniques for Estimating and Testing Multiple Network Autocorrelations. Sociological Methodology, 50, 168–214. doi:10.1177/0081175020913899
Licensed under the GNU General Public License version 2 (June, 1991)
You can install BANAM from github with:
# install.packages("devtools")
::install_github("jomulder/BANAM") devtools
library("BANAM")
library("sna")
library("BFpack")
# Generate data
set.seed(3)
<- 50
n <- .1
d1 <- sna::rgraph(n, tprob=d1, mode="graph")
Wadj1 <- sna::make.stochastic(Wadj1, mode="row")
W1 <- .3
d2 <- sna::rgraph(n, tprob=d2, mode="graph")
Wadj2 <- sna::make.stochastic(Wadj2, mode="row")
W2 # set rho, beta, sigma2, and generate y
<- 0
rho1 <- .4
rho2 <- 3
K <- rnorm(K)
beta <- 1
sigma2 <- matrix(c(rep(1, n), rnorm(n*(K-1))), nrow=n, ncol=K)
X <- c(solve(diag(n) - rho1*W1 - rho2*W2)%*%(X%*%beta + rnorm(n)))
y
# Bayesian estimation of a NAM with a single weight matrix
<- banam(y,X,W1)
best1 print(best1)
# Bayesian estimation of a NAM with two weight matrices
<- banam(y,X,W=list(W1,W2))
best2 print(best2)
# Bayesian hypothesis testing of equality/order constraints on network
# autocorrelation parameters
<- BF(best2,hypothesis="rho1>rho2>0; rho1=rho2>0; rho1=rho2=0")
BFbest2 print(BFbest2)