Modeling a binary network outcome

Peter Hoff

2020-12-15

Load the library:

library(amen)

Set up the data:

data(lazegalaw)

Y<-lazegalaw$Y[,,2]
Xn<-lazegalaw$X[,c(2,4,5,6)]
Xd<-lazegalaw$Y[,,-2]
Xd<-array( c(Xd,outer(Xn[,4],Xn[,4],"==")),dim=dim(Xd)+c(0,0,1))
dimnames(Xd)[[3]]<-c("advice","cowork","samepractice")

dimnames(Xd)[[3]]
## [1] "advice"       "cowork"       "samepractice"
dimnames(Xn)[[2]]
## [1] "female"    "seniority" "age"       "practice"

plot the network with “practice” denoted by plotting color:

netplot(lazegalaw$Y[,,2],ncol=Xn[,4])

fitSRRM<-ame(Y, Xd=Xd, Xr=Xn, Xc=Xn, family="bin")

summary(fitSRRM) 
## 
## Regression coefficients:
##                    pmean   psd z-stat p-val
## intercept         -0.243 0.476 -0.510 0.610
## female.row        -0.023 0.134 -0.174 0.862
## seniority.row     -0.001 0.010 -0.120 0.905
## age.row           -0.016 0.008 -1.911 0.056
## practice.row      -0.138 0.112 -1.237 0.216
## female.col        -0.058 0.120 -0.484 0.629
## seniority.col      0.017 0.009  1.919 0.055
## age.col           -0.008 0.008 -0.985 0.324
## practice.col      -0.199 0.103 -1.931 0.054
## advice.dyad       -0.096 0.082 -1.161 0.246
## cowork.dyad        1.144 0.065 17.687 0.000
## samepractice.dyad  0.449 0.055  8.160 0.000
## 
## Variance parameters:
##     pmean   psd
## va  0.160 0.035
## cab 0.013 0.021
## vb  0.126 0.029
## rho 0.083 0.054
## ve  1.000 0.000
fitAME<-ame(Y, Xd=Xd, Xr=Xn, Xc=Xn, R=3, family="bin")

summary(fitAME) 
## 
## Regression coefficients:
##                    pmean   psd z-stat p-val
## intercept         -0.871 0.693 -1.257 0.209
## female.row        -0.116 0.189 -0.610 0.542
## seniority.row     -0.002 0.015 -0.126 0.900
## age.row           -0.023 0.013 -1.736 0.083
## practice.row      -0.072 0.167 -0.431 0.666
## female.col        -0.102 0.170 -0.603 0.547
## seniority.col      0.010 0.013  0.759 0.448
## age.col           -0.006 0.011 -0.537 0.591
## practice.col      -0.084 0.139 -0.601 0.548
## advice.dyad       -0.136 0.110 -1.236 0.217
## cowork.dyad        1.458 0.092 15.804 0.000
## samepractice.dyad  0.563 0.084  6.709 0.000
## 
## Variance parameters:
##     pmean   psd
## va  0.295 0.075
## cab 0.024 0.041
## vb  0.175 0.052
## rho 0.151 0.088
## ve  1.000 0.000