The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Modeling a binary network outcome

Peter Hoff

2024-02-20

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.247 0.479 -0.516 0.606
## female.row        -0.023 0.134 -0.172 0.863
## seniority.row     -0.001 0.010 -0.124 0.901
## age.row           -0.016 0.008 -1.907 0.057
## practice.row      -0.138 0.112 -1.231 0.218
## female.col        -0.058 0.120 -0.480 0.631
## seniority.col      0.017 0.009  1.925 0.054
## age.col           -0.008 0.008 -0.984 0.325
## practice.col      -0.199 0.102 -1.950 0.051
## advice.dyad       -0.096 0.082 -1.165 0.244
## cowork.dyad        1.144 0.065 17.730 0.000
## samepractice.dyad  0.449 0.055  8.119 0.000
## 
## Variance parameters:
##     pmean   psd
## va  0.160 0.035
## cab 0.013 0.021
## vb  0.126 0.029
## rho 0.082 0.052
## 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.879 0.684 -1.285 0.199
## female.row        -0.116 0.188 -0.618 0.537
## seniority.row     -0.002 0.014 -0.133 0.895
## age.row           -0.023 0.013 -1.773 0.076
## practice.row      -0.068 0.166 -0.413 0.680
## female.col        -0.105 0.166 -0.634 0.526
## seniority.col      0.010 0.013  0.773 0.440
## age.col           -0.006 0.011 -0.519 0.603
## practice.col      -0.084 0.143 -0.589 0.556
## advice.dyad       -0.135 0.109 -1.232 0.218
## cowork.dyad        1.459 0.093 15.681 0.000
## samepractice.dyad  0.565 0.082  6.909 0.000
## 
## Variance parameters:
##     pmean   psd
## va  0.295 0.075
## cab 0.025 0.041
## vb  0.174 0.052
## rho 0.151 0.085
## ve  1.000 0.000

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.