This R-script guides you through an RSiena analysis for bi-partite network evolution. The data for this tutorial can be found on the RSiena website.

(1) Preparatory steps

First we need to download and extract the data. Unfortuantely we do this outside this script.

If not done yet, install the necessary packages.

install.packages("RSiena", repos = "http://cran.us.r-project.org")
install.packages("network", repos = "http://cran.us.r-project.org")
install.packages("sna", repos = "http://cran.us.r-project.org")

To be sure, let us check the package version of RSiena. It should be 1.2-9 or higher.

packageVersion("RSiena")
## [1] '1.2.12'

Let us load the packages so that we can use them.

library(RSiena)
library(sna)
library(network)

Now we can read in the data:
Friendship:

friendship1 <- as.matrix(read.table("Glasgow-1-net.dat"))
friendship2 <- as.matrix(read.table("Glasgow-2-net.dat"))

Demographics:

demographics <- as.matrix(read.table("Glasgow-sex-birthyear.dat"))

Bipartite

leisure1 <- as.matrix(read.table("GL-1-lsr.dat"))
leisure2 <- as.matrix(read.table("GL-2-lsr.dat"))
music1 <- as.matrix(read.table("GL-1-mus.dat"))
music2 <- as.matrix(read.table("GL-2-mus.dat"))
drugs1 <- as.matrix(read.table("GL-1-drg.dat"))
drugs2 <- as.matrix(read.table("GL-2-drg.dat"))

To keep the example simple we will recode the data. All the links in our data are valued. First we make the affiliations binary:

leisure1[leisure1 %in% c(2,3,4)] <- 0
leisure2[leisure2 %in% c(2,3,4)] <- 0
drugs1[drugs1 %in% c(1)] <- 0
drugs1[drugs1 %in% c(2,3,4)] <- 1
drugs2[drugs2 %in% c(1)] <- 0
drugs2[drugs2 %in% c(2,3,4)] <- 1

The friendship data has also be reworked. It is valued and missing data is not coded correctly.

friendship1[friendship1 == 2] <- 1
friendship1[friendship1 == 9] <- NA
friendship2[friendship2 == 2] <- 1
friendship2[friendship2 == 9] <- NA

We do not recode the demographic variables. They only contain 1 missing value on the birht year variable. This variable will not be used in this script.

(2) Inspection of the data

Let’s move on. What is the dimensions of our data set?

nrpupils <- dim(leisure1)[1]
nrleisureItems <- dim(leisure1)[2]
nrmusicItems <- dim(music1)[2]
nrdrugsItems <- dim(drugs1)[2]

Let’s now look at some descriptives:

colMeans(leisure1)
##      V1      V2      V3      V4      V5      V6      V7      V8      V9 
## 0.84375 0.21875 0.49375 0.10625 0.44375 0.43750 0.43750 0.26875 0.08750 
##     V10     V11     V12     V13     V14     V15 
## 0.03125 0.03125 0.00625 0.46875 0.04375 0.05625
colMeans(leisure2)
##      V1      V2      V3      V4      V5      V6      V7      V8      V9 
## 0.79375 0.10625 0.36250 0.03125 0.45625 0.50000 0.28125 0.20625 0.08125 
##     V10     V11     V12     V13     V14     V15 
## 0.01875 0.00625 0.00625 0.43750 0.01875 0.06250
colMeans(music1)
##      V1      V2      V3      V4      V5      V6      V7      V8      V9 
## 0.30000 0.65000 0.20625 0.56250 0.12500 0.54375 0.01875 0.59375 0.12500 
##     V10     V11     V12     V13     V14     V15     V16 
## 0.03125 0.03125 0.09375 0.06875 0.14375 0.26875 0.05625
colMeans(music2)
##      V1      V2      V3      V4      V5      V6      V7      V8      V9 
## 0.26250 0.64375 0.10625 0.50625 0.06250 0.41250 0.03750 0.50000 0.24375 
##     V10     V11     V12     V13     V14     V15     V16 
## 0.04375 0.02500 0.11875 0.06250 0.06250 0.18750 0.05000
colMeans(drugs1)
##      V1      V2      V3      V4      V5      V6      V7      V8      V9 
## 0.27500 0.06250 0.03125 0.06250 0.06250 0.03750 0.01250 0.01250 0.01250 
##     V10     V11     V12     V13     V14 
## 0.00625 0.01875 0.08125 0.02500 0.00000
colMeans(drugs2)
##      V1      V2      V3      V4      V5      V6      V7      V8      V9 
## 0.31875 0.03750 0.04375 0.11875 0.06250 0.08125 0.00625 0.01250 0.01250 
##     V10     V11     V12     V13     V14 
## 0.00000 0.02500 0.05000 0.01875 0.00625

In previos scripts we discussed how to inspect change over time. We will skip this for now.

(3) Preparing variables for RSiena

First we define the different nodesets:

pupils <- sienaNodeSet(nrpupils, nodeSetName = "pupils")
leisureItems <- sienaNodeSet(nrleisureItems, nodeSetName = "leisureItems")
musicItems <- sienaNodeSet(nrmusicItems, nodeSetName = "musicItems")
drugsItems <- sienaNodeSet(nrdrugsItems, nodeSetName = "drugsItems")

Now we identify the dependent variables.
Bipartite network:

leisure <- sienaDependent(array(c(leisure1, leisure2),
                dim = c(nrpupils, nrleisureItems,2)),
                "bipartite", nodeSet = c("pupils", "leisureItems"))
music <- sienaDependent(array(c(music1, music2),
                dim = c(nrpupils, nrmusicItems,2)),
                "bipartite", nodeSet = c("pupils", "musicItems"))
drugs <- sienaDependent(array(c(drugs1, drugs2),
                dim = c(nrpupils, nrdrugsItems,2)),
                "bipartite", nodeSet = c("pupils","drugsItems"))

One-mode network:

friendship <- sienaDependent(array(c(friendship1, friendship2),
                dim = c(nrpupils, nrpupils,2)), nodeSet = "pupils")

Now we include gender.

sex.F <- coCovar(demographics[, 1], nodeSet = "pupils")

All the data is ready now, so let’s combine it:

bipData <- sienaDataCreate(friendship, leisure, music, drugs, sex.F,
 nodeSets = list(pupils, leisureItems, musicItems, drugsItems))

(4)Specifying the model

The analysis of all this considerable data set can be time-consuming. Of course there is also the possibility to use less than 3 (e.g., 1) of the 2-mode networks.

First we get the effects table for model specification:

bipEffects <- getEffects(bipData)

We can generate an initial descriptive outputfile:

print01Report(bipData,modelname = 'bipEffects-descriptive')

File “netDynamics-descriptive.out” was created in the working directory. You can use getwd() to find your current directory. But I recommend to use Rprojects in RStudio.

Take a look at the generated output file “Bipartite-illustration.out” to see how RSiena interpreted the directives provided and to get an impression of the data (eyeball the degrees, look at occurrence of missings, look at Jaccard indices).

Let’s add some effects:

bipEffects <- includeEffects(bipEffects, inPopSqrt,outActSqrt,gwespFF, name = "friendship")
##   effectName                               include fix   test 
## 1 friendship: GWESP I -> K -> J (#)        TRUE    FALSE FALSE
## 2 friendship: indegree - popularity (sqrt) TRUE    FALSE FALSE
## 3 friendship: outdegree - activity (sqrt)  TRUE    FALSE FALSE
##   initialValue parm
## 1          0   69  
## 2          0    0  
## 3          0    1
bipEffects <- includeEffects(bipEffects, from, name = "friendship",
                            interaction1 = "leisure")
##   effectName                         include fix   test  initialValue parm
## 1 friendship: from leisure agreement TRUE    FALSE FALSE          0   0
bipEffects <- includeEffects(bipEffects, from, name = "friendship",
                            interaction1 = "music")
##   effectName                       include fix   test  initialValue parm
## 1 friendship: from music agreement TRUE    FALSE FALSE          0   0
bipEffects <- includeEffects(bipEffects, from, name = "friendship",
                            interaction1 = "drugs")
##   effectName                       include fix   test  initialValue parm
## 1 friendship: from drugs agreement TRUE    FALSE FALSE          0   0
bipEffects <- includeEffects(bipEffects, cycle4, name = "leisure")
##   effectName            include fix   test  initialValue parm
## 1 leisure: 4-cycles (#) TRUE    FALSE FALSE          0   1
bipEffects <- includeEffects(bipEffects, cycle4, name = "music")
##   effectName          include fix   test  initialValue parm
## 1 music: 4-cycles (#) TRUE    FALSE FALSE          0   1
bipEffects <- includeEffects(bipEffects, cycle4, name = "drugs")
##   effectName          include fix   test  initialValue parm
## 1 drugs: 4-cycles (#) TRUE    FALSE FALSE          0   1
bipEffects <- includeEffects(bipEffects, to, name = "leisure",
                             interaction1 = "friendship")
##   effectName                       include fix   test  initialValue parm
## 1 leisure: friendship to agreement TRUE    FALSE FALSE          0   0
bipEffects <- includeEffects(bipEffects, to, name = "music",
                             interaction1 = "friendship")
##   effectName                     include fix   test  initialValue parm
## 1 music: friendship to agreement TRUE    FALSE FALSE          0   0
bipEffects <- includeEffects(bipEffects, to, name = "drugs",
                             interaction1 = "friendship")
##   effectName                     include fix   test  initialValue parm
## 1 drugs: friendship to agreement TRUE    FALSE FALSE          0   0
bipEffects <- includeEffects(bipEffects, egoX,altX,simX, name = "friendship",
                            interaction1 = "sex.F")
##   effectName                   include fix   test  initialValue parm
## 1 friendship: sex.F alter      TRUE    FALSE FALSE          0   0   
## 2 friendship: sex.F ego        TRUE    FALSE FALSE          0   0   
## 3 friendship: sex.F similarity TRUE    FALSE FALSE          0   0
bipEffects

(5) Model estimation

First we specify our algorithm:

bipModel <- sienaAlgorithmCreate(projname = 'bipartite-Glasgow-results',
                                 seed = 432155)

Finally we can start with the estimation:

(bipResults <- siena07(bipModel, data = bipData, effects = bipEffects, useCluster = TRUE,
                       nbrNodes = 4))
## Estimates, standard errors and convergence t-ratios
## 
##                                                     Estimate   Standard   Convergence 
##                                                                  Error      t-ratio   
##    1. rate basic rate parameter friendship          14.0728  ( 1.2619   )   -0.0610   
##    2. eval friendship: outdegree (density)          -0.7072  ( 0.3788   )    0.0605   
##    3. eval friendship: reciprocity                   1.8380  ( 0.1262   )    0.0649   
##    4. eval friendship: GWESP I -> K -> J (69)        1.6384  ( 0.0969   )    0.0557   
##    5. eval friendship: indegree - popularity (sqrt) -0.2137  ( 0.1049   )    0.0389   
##    6. eval friendship: outdegree - activity (sqrt)  -0.7077  ( 0.1230   )    0.0462   
##    7. eval friendship: sex.F alter                  -0.1373  ( 0.1270   )    0.0468   
##    8. eval friendship: sex.F ego                     0.1094  ( 0.1405   )    0.0769   
##    9. eval friendship: sex.F similarity              0.7667  ( 0.1150   )    0.0675   
##   10. eval friendship: from leisure agreement        0.0542  ( 0.0492   )    0.0351   
##   11. eval friendship: from music agreement          0.0513  ( 0.0442   )    0.0349   
##   12. eval friendship: from drugs agreement         -0.2148  ( 0.1117   )   -0.0005   
##   13. rate basic rate parameter leisure              4.4671  ( 0.3621   )   -0.0489   
##   14. eval leisure: outdegree (density)             -1.8449  ( 0.1112   )    0.0376   
##   15. eval leisure: 4-cycles (1)                     0.0071  ( 0.0011   )    0.0294   
##   16. eval leisure: friendship to agreement          0.3557  ( 0.0688   )    0.0431   
##   17. rate basic rate parameter music                5.1645  ( 0.3910   )   -0.0178   
##   18. eval music: outdegree (density)               -1.7567  ( 0.0903   )   -0.0886   
##   19. eval music: 4-cycles (1)                       0.0075  ( 0.0011   )   -0.1047   
##   20. eval music: friendship to agreement            0.3198  ( 0.0586   )   -0.0847   
##   21. rate basic rate parameter drugs                2.4501  ( 0.4181   )   -0.1695   
##   22. eval drugs: outdegree (density)               -3.5416  ( 0.3027   )   -0.1491   
##   23. eval drugs: 4-cycles (1)                       0.1617  ( 0.0330   )   -0.1842   
##   24. eval drugs: friendship to agreement            1.2208  ( 0.2376   )   -0.1487   
## 
## Overall maximum convergence ratio:    0.3061 
## 
## 
## Total of 2032 iteration steps.

The convergence is nearly there. But let’s be save and start again. Maybe it also helps to increase phase 3 simulations to get better estiamtes of the standard errors.

bipModel <- sienaAlgorithmCreate(projname = 'bipartite-Glasgow-results',
                                 seed = 432155, n3 = 2000)
bipResults <- siena07(bipModel, data = bipData, effects = bipEffects,
                            prevAns = bipResults, returnDeps = TRUE, useCluster = TRUE,
                       nbrNodes = 4)
bipResults
## Estimates, standard errors and convergence t-ratios
## 
##                                                     Estimate   Standard   Convergence 
##                                                                  Error      t-ratio   
##    1. rate basic rate parameter friendship          14.1252  ( 1.4351   )    0.0151   
##    2. eval friendship: outdegree (density)          -0.7407  ( 0.3667   )   -0.0206   
##    3. eval friendship: reciprocity                   1.8406  ( 0.1136   )   -0.0146   
##    4. eval friendship: GWESP I -> K -> J (69)        1.6344  ( 0.0996   )   -0.0162   
##    5. eval friendship: indegree - popularity (sqrt) -0.2087  ( 0.1024   )   -0.0284   
##    6. eval friendship: outdegree - activity (sqrt)  -0.6979  ( 0.1138   )   -0.0275   
##    7. eval friendship: sex.F alter                  -0.1302  ( 0.1178   )    0.0499   
##    8. eval friendship: sex.F ego                     0.1027  ( 0.1535   )    0.0386   
##    9. eval friendship: sex.F similarity              0.7605  ( 0.1171   )   -0.0182   
##   10. eval friendship: from leisure agreement        0.0537  ( 0.0534   )   -0.0483   
##   11. eval friendship: from music agreement          0.0501  ( 0.0467   )   -0.0195   
##   12. eval friendship: from drugs agreement         -0.2125  ( 0.1308   )   -0.0206   
##   13. rate basic rate parameter leisure              4.4715  ( 0.3451   )   -0.0099   
##   14. eval leisure: outdegree (density)             -1.8495  ( 0.1041   )    0.0186   
##   15. eval leisure: 4-cycles (1)                     0.0072  ( 0.0012   )    0.0304   
##   16. eval leisure: friendship to agreement          0.3525  ( 0.0659   )    0.0252   
##   17. rate basic rate parameter music                5.1511  ( 0.4072   )   -0.0272   
##   18. eval music: outdegree (density)               -1.7612  ( 0.0905   )   -0.0233   
##   19. eval music: 4-cycles (1)                       0.0076  ( 0.0011   )   -0.0217   
##   20. eval music: friendship to agreement            0.3197  ( 0.0612   )   -0.0073   
##   21. rate basic rate parameter drugs                2.4686  ( 0.3898   )    0.0482   
##   22. eval drugs: outdegree (density)               -3.5485  ( 0.3228   )    0.0353   
##   23. eval drugs: 4-cycles (1)                       0.1665  ( 0.0356   )    0.0327   
##   24. eval drugs: friendship to agreement            1.2102  ( 0.2180   )    0.0132   
## 
## Overall maximum convergence ratio:    0.1604 
## 
## 
## Total of 3220 iteration steps.

It takes quite long to estimate. So let’s better save the results.

save.image("bipResults1.RData")

(6) Goodness of fit

Now let us assess goodness of fit for the three estimated models. This is done separately for the various dependent variables as indicated by the varName parameter in sienaGOF.

Friendship

Outdegree

gofo1f <- sienaGOF(bipResults, OutdegreeDistribution, join = TRUE,
                    varName = "friendship")
##   > Completed  2000  calculations
plot(gofo1f)

That does not fit well.

Indegree

gofi1f <- sienaGOF(bipResults, IndegreeDistribution, join = TRUE,
                    varName = "friendship")
##   > Completed  2000  calculations
plot(gofi1f)

This fits very well.

Triad Census

gof1.triads <- sienaGOF(bipResults,TriadCensus, join = TRUE,
                            varName = "friendship")
##   > Completed  2000  calculations
plot(gof1.triads,center = TRUE,scale = TRUE)

This fits quite badly!
Especially 030C, 120D, 120C and 300.

Leisure

Outdegree

gofo1l <- sienaGOF(bipResults, OutdegreeDistribution, join = TRUE,
                    varName = "leisure")
##   > Completed  2000  calculations
plot(gofo1l)

That, too, fits bad.

gofi1l <- sienaGOF(bipResults, IndegreeDistribution, join = TRUE,
                    varName = "leisure")
##   > Completed  2000  calculations
plot(gofi1l)

This does not fit well.

Music

Outdegree

gofo1m <- sienaGOF(bipResults, OutdegreeDistribution, join = TRUE,
                    varName = "music")
##   > Completed  2000  calculations
plot(gofo1m)

This does not fit too well.

Indegree

gofi1m <- sienaGOF(bipResults, IndegreeDistribution, join = TRUE,
                    varName = "music")
##   > Completed  2000  calculations
plot(gofi1m)

This fits ok.

Drugs

Outdegree

gofo1d <- sienaGOF(bipResults, OutdegreeDistribution, join = TRUE,
                    varName = "drugs")
##   > Completed  2000  calculations
plot(gofo1d)

This is ok.

Indegree

gofi1d <- sienaGOF(bipResults, IndegreeDistribution, join = TRUE,
                    varName = "drugs")
##   > Completed  2000  calculations
plot(gofi1d)

This fits very well.

To conclude: We need better fit for:
Friendship, Leisure and Music

Improved model

Let us include some effects for the distribution of Leisure and Music To keep the model equal on the bipartite part, we add the same effect also for Drugs.

bipEffects <- includeEffects(bipEffects, outActSqrt, name = "leisure")
##   effectName                           include fix   test  initialValue
## 1 leisure: outdegree - activity (sqrt) TRUE    FALSE FALSE          0  
##   parm
## 1 0
bipEffects <- includeEffects(bipEffects, outActSqrt, name = "music")
##   effectName                         include fix   test  initialValue parm
## 1 music: outdegree - activity (sqrt) TRUE    FALSE FALSE          0   0
bipEffects <- includeEffects(bipEffects, inPopSqrt,  name = "leisure")
##   effectName                            include fix   test  initialValue
## 1 leisure: indegree - popularity (sqrt) TRUE    FALSE FALSE          0  
##   parm
## 1 0
bipEffects <- includeEffects(bipEffects, inPopSqrt,  name = "music")
##   effectName                          include fix   test  initialValue
## 1 music: indegree - popularity (sqrt) TRUE    FALSE FALSE          0  
##   parm
## 1 0
bipEffects <- includeEffects(bipEffects, egoX,  name = "leisure",
                             interaction1 = "sex.F")
##   effectName         include fix   test  initialValue parm
## 1 leisure: sex.F ego TRUE    FALSE FALSE          0   0
bipEffects <- includeEffects(bipEffects, egoX,  name = "music",
                             interaction1 = "sex.F")
##   effectName       include fix   test  initialValue parm
## 1 music: sex.F ego TRUE    FALSE FALSE          0   0

Further we can add some effects for better network fit for friendship:

bipEffects <- includeEffects(bipEffects, gwespBB, gwespBF, reciAct, inActSqrt, name = "friendship")
##   effectName                              include fix   test  initialValue
## 1 friendship: GWESP I <- K <- J (#)       TRUE    FALSE FALSE          0  
## 2 friendship: GWESP I <- K -> J (#)       TRUE    FALSE FALSE          0  
## 3 friendship: indegree - activity (sqrt)  TRUE    FALSE FALSE          0  
## 4 friendship: rec.degree^(1/#) - activity TRUE    FALSE FALSE          0  
##   parm
## 1 69  
## 2 69  
## 3  0  
## 4  1
bipModel <- sienaAlgorithmCreate(projname = 'bipartite-Glasgow-results',
                                 seed = 432155, n3 = 2000)
bipResults2 <- siena07(bipModel, data = bipData, effects = bipEffects,
                            prevAns = bipResults, returnDeps = TRUE, 
                            useCluster = TRUE, nbrNodes = 2)
bipModel <- sienaAlgorithmCreate(projname = 'bipartite-Glasgow-results',
                                 seed = 432155, n3 = 2000, nsub = 1,
                                 n2start = 1200)

bipResults2 <- siena07(bipModel, data = bipData, effects = bipEffects,
                            prevAns = bipResults2, returnDeps = TRUE, 
                            useCluster = TRUE, nbrNodes = 2)
bipResults2
## Estimates, standard errors and convergence t-ratios
## 
##                                                     Estimate   Standard   Convergence 
##                                                                  Error      t-ratio   
##    1. rate basic rate parameter friendship          13.4080  ( 4.8393   )   -0.0186   
##    2. eval friendship: outdegree (density)          -2.4413  ( 0.7457   )   -0.0006   
##    3. eval friendship: reciprocity                   3.1072  ( 0.4096   )    0.0019   
##    4. eval friendship: GWESP I -> K -> J (69)        1.9731  ( 0.9035   )   -0.0027   
##    5. eval friendship: GWESP I <- K <- J (69)        0.6210  ( 0.4147   )    0.0051   
##    6. eval friendship: GWESP I <- K -> J (69)       -0.8457  ( 1.2321   )   -0.0101   
##    7. eval friendship: indegree - popularity (sqrt) -0.0752  ( 0.1345   )   -0.0008   
##    8. eval friendship: indegree - activity (sqrt)    0.1592  ( 0.2456   )   -0.0034   
##    9. eval friendship: outdegree - activity (sqrt)  -0.1591  ( 0.2797   )   -0.0097   
##   10. eval friendship: rec.degree^(1/1) - activity  -0.2900  ( 0.1211   )   -0.0051   
##   11. eval friendship: sex.F alter                  -0.1189  ( 0.1417   )    0.0015   
##   12. eval friendship: sex.F ego                     0.0961  ( 0.1532   )    0.0061   
##   13. eval friendship: sex.F similarity              0.7055  ( 0.1378   )   -0.0187   
##   14. eval friendship: from leisure agreement        0.0710  ( 0.0591   )   -0.0107   
##   15. eval friendship: from music agreement          0.0567  ( 0.0494   )    0.0071   
##   16. eval friendship: from drugs agreement         -0.2064  ( 0.1611   )   -0.0164   
##   17. rate basic rate parameter leisure              4.7391  ( 0.6046   )   -0.0181   
##   18. eval leisure: outdegree (density)             -3.7676  ( 0.7570   )    0.0250   
##   19. eval leisure: 4-cycles (1)                     0.0001  ( 0.0025   )    0.0079   
##   20. eval leisure: indegree - popularity (sqrt)     0.2714  ( 0.0581   )    0.0199   
##   21. eval leisure: outdegree - activity (sqrt)      0.3065  ( 0.2060   )    0.0169   
##   22. eval leisure: sex.F ego                       -0.0260  ( 0.0982   )   -0.0123   
##   23. eval leisure: friendship to agreement          0.1890  ( 0.0735   )    0.0251   
##   24. rate basic rate parameter music                5.3070  ( 0.4139   )    0.0018   
##   25. eval music: outdegree (density)               -2.3231  ( 0.5384   )   -0.0013   
##   26. eval music: 4-cycles (1)                       0.0051  ( 0.0023   )   -0.0068   
##   27. eval music: indegree - popularity (sqrt)       0.1010  ( 0.0482   )   -0.0010   
##   28. eval music: outdegree - activity (sqrt)        0.0613  ( 0.1332   )   -0.0047   
##   29. eval music: sex.F ego                          0.0386  ( 0.1053   )    0.0104   
##   30. eval music: friendship to agreement            0.2488  ( 0.0838   )    0.0132   
##   31. rate basic rate parameter drugs                2.4547  ( 0.4396   )   -0.0233   
##   32. eval drugs: outdegree (density)               -3.6168  ( 0.3926   )   -0.0027   
##   33. eval drugs: 4-cycles (1)                       0.1653  ( 0.0363   )   -0.0051   
##   34. eval drugs: friendship to agreement            1.2743  ( 0.2657   )    0.0040   
## 
## Overall maximum convergence ratio:    0.1759 
## 
## 
## Total of 3200 iteration steps.

The model is converged. Let’s check the fit again.

Goodness of fit

Now let us assess goodness of fit for the three estimated models. This is done separately for the various dependent variables as indicated by the varName parameter in sienaGOF.

Friendship

Outdegree

gofo2f <- sienaGOF(bipResults2, OutdegreeDistribution, join = TRUE,
                   varName = "friendship")
##   > Completed  2000  calculations
plot(gofo2f)

Still not ideal.

Indegree

gofi2f <- sienaGOF(bipResults2, IndegreeDistribution, join = TRUE,
                   varName = "friendship")
##   > Completed  2000  calculations
plot(gofi2f)

This fits very well.

Triad Census

gof2.triads <- sienaGOF(bipResults2,TriadCensus, join = TRUE,
                        varName = "friendship")
##   > Completed  2000  calculations
plot(gof2.triads,center = TRUE,scale = TRUE)

This fits fine now.
120C and 300 are not perfect, but overall it is fine overall.

Leisure

Outdegree

gofo2l <- sienaGOF(bipResults2, OutdegreeDistribution, join = TRUE,
                   varName = "leisure")
##   > Completed  2000  calculations
plot(gofo2l)

This, still, fits bad.

gofi2l <- sienaGOF(bipResults2, IndegreeDistribution, join = TRUE,
                   varName = "leisure")
##   > Completed  2000  calculations
plot(gofi2l)

This fits fine now.

Music

Outdegree

gofo2m <- sienaGOF(bipResults2, OutdegreeDistribution, join = TRUE,
                   varName = "music")
##   > Completed  2000  calculations
plot(gofo2m)

This is still not optimal.

Indegree

gofi2m <- sienaGOF(bipResults2, IndegreeDistribution, join = TRUE,
                   varName = "music")
##   > Completed  2000  calculations
plot(gofi2m)

This fits ok.

Drugs

Outdegree

gofo2d <- sienaGOF(bipResults2, OutdegreeDistribution, join = TRUE,
                   varName = "drugs")
##   > Completed  2000  calculations
plot(gofo2d)

This is ok.

Indegree

gofi2d <- sienaGOF(bipResults2, IndegreeDistribution, join = TRUE,
                   varName = "drugs")
##   > Completed  2000  calculations
plot(gofi2d)

This fits very well.

To conclude: We need better fit for:
Friendship, Leisure and Music