Modeling a binary network outcome

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]]
dimnames(Xn)[[2]]

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) 
fitAME<-ame(Y, Xd=Xd, Xr=Xn, Xc=Xn, R=3, family="bin")
summary(fitAME) 


Try the amen package in your browser

Any scripts or data that you put into this service are public.

amen documentation built on May 29, 2024, 9:58 a.m.