#load needed libraries library(sna) library(numDeriv) ?lnam #select the node-level covariates x<-as.matrix(s_nodes[c("FEMALE","WHITE","S3")]) summary(x) #create the weight matrix from the network object #here i created a row-normalized version of the adj. matrix to use as W w1<-as.sociomatrix(s_friends,attrname="rnorm") fights<-as.matrix(s_nodes[c("S64")]) summary(fights) class(fights) class(x) class(w1) #simple model w. row-weighted peer effects pim1<-lnam(fights,x,w1) summary(pim1) #add a second net effect on the disturbances, here from club overlap clbs<-as.sociomatrix(s_clubs,attrname="ovlpec") pim2<-lnam(fights,cv,w1,clbs) summary(pim2)