When I tried appending the TERGM files to the HTML output it kept crashing so I broke this part of my analysis into the second page. I decided to simulate networks for rounds 5, 6, 7, 8, 9, and 10. I am assuming that later rounds will have little change in the communication networks (these models do not have a knockout).
I am now going to run some TERGM models to test this. In my simulated model, closer GPAs and similar grades lead to a greater likelihood to have a connection. Additionally, the communication network will likely have many closed triangles, mutuality, and nodes will have homophily. This is because participants will select friends for their communiation network and friends tend to have similar characteristics and are in the same social circles.
As the game progresses, I am assuming that a few players will direct the troop placement of the other participants. Therefore, I am assuming that ostar and memory will be important in the TERGM models.
#1
adj.1 <- as_adjacency_matrix(g1)
n1 <- as.network(adj.1)
Note: method with signature <U+393C><U+3E31>CsparseMatrix#Matrix#missing#replValue<U+393C><U+3E32> chosen for function <U+393C><U+3E31>[<-<U+393C><U+3E32>,
target signature <U+393C><U+3E31>dgCMatrix#nsCMatrix#missing#numeric<U+393C><U+3E32>.
"Matrix#nsparseMatrix#missing#replValue" would also be valid
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#2
adj.2 <- as_adjacency_matrix(g2)
n2 <- as.network(adj.2)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#3
adj.3 <- as_adjacency_matrix(g3)
n3 <- as.network(adj.3)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#4
adj.4 <- as_adjacency_matrix(g4)
n4 <- as.network(adj.4)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#5
adj.5 <- as_adjacency_matrix(g5)
n5 <- as.network(adj.5)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#6
adj.6 <- as_adjacency_matrix(g6)
n6 <- as.network(adj.6)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#7
adj.7 <- as_adjacency_matrix(g7)
n7 <- as.network(adj.7)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#8
adj.8 <- as_adjacency_matrix(g8)
n8 <- as.network(adj.8)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#9
adj.9 <- as_adjacency_matrix(g9)
n9 <- as.network(adj.9)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
#10
adj.10 <- as_adjacency_matrix(g10)
n10 <- as.network(adj.10)
<sparse>[ <logic> ] : .M.sub.i.logical() maybe inefficient
Now, I am going to run a few TERGM tests. The models will start off simple and become more complicated. In the first two iterations, I am only going to include endogenous effects. The later models will have covariates. They will continue becoming more complex until they become degenerative.
#TERGM 1
set.seed(12345)
hga <- list(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10)
tergm.1 <- btergm(hga ~ edges
+ mutual)
No covariates provided.
All networks are conformable.
Starting pseudolikelihood estimation with 500 bootstrapping replications on a single computing core...
Done.
summary(tergm.1)
==========================
Summary of model fit
==========================
Formula: hga ~ edges + mutual
Time steps: 10
Bootstrapping sample size: 500
Estimates and 95% confidence intervals:
Estimate 2.5% 97.5%
edges -1.1193 -1.2364 -1.0067
mutual -1.4064 -2.5481 -0.8430
tergm.gof1 <- gof(tergm.1, statistics = c(esp, dsp, geodesic,deg, triad.undirected, walktrap.modularity))
Starting GOF assessment on a single computing core....
No covariates provided.
All networks are conformable.
No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.
Simulating 100 networks from the following formula:
hga[[1]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[2]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[3]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[4]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[5]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[6]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[7]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[8]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[9]] ~ edges + mutual
Simulating 100 networks from the following formula:
hga[[10]] ~ edges + mutual
10 networks from which simulations are drawn were provided.
Processing statistic: Edge-wise shared partners
Processing statistic: Dyad-wise shared partners
Processing statistic: Geodesic distances
Processing statistic: Degree
Processing statistic: Triad census
Processing statistic: Modularity (walktrap)
plot(tergm.gof1)
The first model has good fit. I found this surprising because the first 5 models lose 5 edges per round until they become relatively static. To explore this effect further, I added in mutual and triangles and two and three in and out stars to my model. In the real experiment, I would expect to see more two and three stars and sociality because a few players will likely coordinate placement. I also included memory in this model because players are likely to coordinate with the same people in every round. When I added in exogenous effects into my model, there was a negligible improvement in fit. Therefore, I decided to use the second model with only endogenous effects because it was more parsimonious.
hga <- list(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10)
tergm.2 <- btergm(hga ~ edges + triangles +
+ mutual + istar(2:3) + ostar(2:3)
+ memory(type="stability")
, R=100)
Initial dimensions of the network and covariates:
t=2 t=3 t=4 t=5 t=6 t=7 t=8 t=9 t=10
hga (row) 10 10 10 10 10 10 10 10 10
hga (col) 10 10 10 10 10 10 10 10 10
memory (row) 10 10 10 10 10 10 10 10 10
memory (col) 10 10 10 10 10 10 10 10 10
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3 t=4 t=5 t=6 t=7 t=8 t=9 t=10
hga (row) 10 10 10 10 10 10 10 10 10
hga (col) 10 10 10 10 10 10 10 10 10
memory (row) 10 10 10 10 10 10 10 10 10
memory (col) 10 10 10 10 10 10 10 10 10
Starting pseudolikelihood estimation with 100 bootstrapping replications on a single computing core...
Done.
summary(tergm.2)
==========================
Summary of model fit
==========================
Formula: hga ~ edges + triangles + +mutual + istar(2:3) + ostar(2:3) + memory(type = "stability")
Time steps: 9
Bootstrapping sample size: 100
Estimates and 95% confidence intervals:
Estimate 2.5% 97.5%
edges 0.32812 -1.0976 1.9951
triangle 0.19759 -0.3697 0.7540
mutual -2.29382 -3.9686 -0.3628
istar2 -0.35291 -0.8824 0.2617
istar3 0.29288 -0.0726 0.5216
ostar2 -0.82744 -1.9043 0.6047
ostar3 0.29966 -0.9149 1.0017
edgecov.memory[[i]] 3.38132 3.0529 4.3654
tergm.gof.2 <- gof(tergm.2, statistics = c(esp, dsp, geodesic,deg, triad.undirected, walktrap.modularity))
Starting GOF assessment on a single computing core....
Initial dimensions of the network and covariates:
t=2 t=3 t=4 t=5 t=6 t=7 t=8 t=9 t=10
hga (row) 10 10 10 10 10 10 10 10 10
hga (col) 10 10 10 10 10 10 10 10 10
memory (row) 10 10 10 10 10 10 10 10 10
memory (col) 10 10 10 10 10 10 10 10 10
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3 t=4 t=5 t=6 t=7 t=8 t=9 t=10
hga (row) 10 10 10 10 10 10 10 10 10
hga (col) 10 10 10 10 10 10 10 10 10
memory (row) 10 10 10 10 10 10 10 10 10
memory (col) 10 10 10 10 10 10 10 10 10
No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.
Simulating 100 networks from the following formula:
hga[[1]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[1]])
Simulating 100 networks from the following formula:
hga[[2]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[2]])
Simulating 100 networks from the following formula:
hga[[3]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[3]])
Simulating 100 networks from the following formula:
hga[[4]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[4]])
Simulating 100 networks from the following formula:
hga[[5]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[5]])
Simulating 100 networks from the following formula:
hga[[6]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[6]])
Simulating 100 networks from the following formula:
hga[[7]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[7]])
Simulating 100 networks from the following formula:
hga[[8]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[8]])
Simulating 100 networks from the following formula:
hga[[9]] ~ edges + triangles + mutual + istar(2:3) + ostar(2:3) + edgecov(memory[[9]])
9 networks from which simulations are drawn were provided.
Processing statistic: Edge-wise shared partners
Processing statistic: Dyad-wise shared partners
Processing statistic: Geodesic distances
Processing statistic: Degree
Processing statistic: Triad census
Processing statistic: Modularity (walktrap)
plot(tergm.gof.2)
hga <- list(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10)
#tergm.3 <- btergm(hga ~ edges + triangles +
# + mutual + istar(2:3) + ostar(2:3)
# + absdiff("GPA")
# + absdiff("grade")
# + memory(type="stability")
# , R=100)
#summary(tergm.3)
#tergm.gof.3 <- gof(tergm.3, statistics = c(esp, dsp, geodesic,deg, #triad.undirected, walktrap.modularity))
#plot(tergm.gof.3)
I tried other variations with endogenous effects but the model became degenerative. This model suggests that endogenous factors were better predictors of commnuication networks for the simulated networks than covariate attributes. Since the networks I am using only have ten nodes, I decided to run a TERGM file with the preloaded data. I am not sure if the samplk data are longitudinal, but I wanted to use different data than from the article Journal of Statistical Software.
data(samplk)
summary(samplk1)
Network attributes:
vertices = 18
directed = TRUE
hyper = FALSE
loops = FALSE
multiple = FALSE
bipartite = FALSE
total edges = 55
missing edges = 0
non-missing edges = 55
density = 0.1797386
Vertex attributes:
cloisterville:
logical valued attribute
attribute summary:
Mode FALSE TRUE NA's
logical 12 6 0
group:
character valued attribute
attribute summary:
Loyal Outcasts Turks Waverers
5 3 7 3
vertex.names:
character valued attribute
18 valid vertex names
No edge attributes
Network edgelist matrix:
[,1] [,2]
[1,] 3 2
[2,] 15 2
[3,] 5 4
[4,] 1 5
[5,] 4 5
[6,] 13 7
[7,] 11 8
[8,] 8 9
[9,] 9 16
[10,] 17 18
[11,] 2 1
[12,] 3 1
[13,] 6 1
[14,] 8 1
[15,] 12 1
[16,] 14 1
[17,] 15 1
[18,] 16 1
[19,] 18 1
[20,] 7 2
[21,] 8 2
[22,] 12 2
[23,] 16 2
[24,] 18 2
[25,] 1 3
[26,] 17 3
[27,] 6 4
[28,] 10 4
[29,] 9 5
[30,] 11 5
[31,] 13 5
[32,] 4 6
[33,] 2 7
[34,] 16 7
[35,] 18 7
[36,] 7 8
[37,] 9 8
[38,] 10 8
[39,] 6 9
[40,] 4 10
[41,] 5 11
[42,] 14 11
[43,] 14 12
[44,] 5 13
[45,] 17 13
[46,] 1 14
[47,] 2 14
[48,] 10 14
[49,] 11 14
[50,] 12 14
[51,] 15 14
[52,] 14 15
[53,] 7 16
[54,] 3 17
[55,] 13 18
summary(samplk2)
Network attributes:
vertices = 18
directed = TRUE
hyper = FALSE
loops = FALSE
multiple = FALSE
bipartite = FALSE
total edges = 57
missing edges = 0
non-missing edges = 57
density = 0.1862745
Vertex attributes:
cloisterville:
logical valued attribute
attribute summary:
Mode FALSE TRUE NA's
logical 12 6 0
group:
character valued attribute
attribute summary:
Loyal Outcasts Turks Waverers
5 3 7 3
vertex.names:
character valued attribute
18 valid vertex names
No edge attributes
Network edgelist matrix:
[,1] [,2]
[1,] 7 1
[2,] 1 2
[3,] 12 2
[4,] 15 2
[5,] 5 4
[6,] 1 5
[7,] 4 5
[8,] 8 10
[9,] 10 13
[10,] 18 17
[11,] 17 18
[12,] 2 1
[13,] 3 1
[14,] 5 1
[15,] 6 1
[16,] 12 1
[17,] 14 1
[18,] 15 1
[19,] 7 2
[20,] 14 2
[21,] 16 2
[22,] 17 2
[23,] 18 2
[24,] 17 3
[25,] 6 4
[26,] 8 4
[27,] 10 4
[28,] 11 4
[29,] 9 5
[30,] 10 5
[31,] 11 5
[32,] 13 5
[33,] 15 5
[34,] 4 6
[35,] 8 6
[36,] 2 7
[37,] 13 7
[38,] 16 7
[39,] 1 8
[40,] 9 8
[41,] 6 9
[42,] 4 11
[43,] 5 11
[44,] 2 12
[45,] 9 12
[46,] 14 12
[47,] 16 12
[48,] 18 13
[49,] 12 14
[50,] 15 14
[51,] 2 15
[52,] 14 15
[53,] 7 16
[54,] 11 16
[55,] 3 17
[56,] 3 18
[57,] 13 18
summary(samplk3)
Network attributes:
vertices = 18
directed = TRUE
hyper = FALSE
loops = FALSE
multiple = FALSE
bipartite = FALSE
total edges = 56
missing edges = 0
non-missing edges = 56
density = 0.1830065
Vertex attributes:
cloisterville:
logical valued attribute
attribute summary:
Mode FALSE TRUE NA's
logical 12 6 0
group:
character valued attribute
attribute summary:
Loyal Outcasts Turks Waverers
5 3 7 3
vertex.names:
character valued attribute
18 valid vertex names
No edge attributes
Network edgelist matrix:
[,1] [,2]
[1,] 15 2
[2,] 1 3
[3,] 5 4
[4,] 4 5
[5,] 9 8
[6,] 11 8
[7,] 8 9
[8,] 10 9
[9,] 14 12
[10,] 10 13
[11,] 16 15
[12,] 18 17
[13,] 17 18
[14,] 2 1
[15,] 3 1
[16,] 12 1
[17,] 14 1
[18,] 7 2
[19,] 12 2
[20,] 16 2
[21,] 17 2
[22,] 18 2
[23,] 17 3
[24,] 18 3
[25,] 6 4
[26,] 8 4
[27,] 10 4
[28,] 6 5
[29,] 9 5
[30,] 10 5
[31,] 11 5
[32,] 13 5
[33,] 4 6
[34,] 8 6
[35,] 2 7
[36,] 12 7
[37,] 13 7
[38,] 15 7
[39,] 16 7
[40,] 5 9
[41,] 6 9
[42,] 4 11
[43,] 5 11
[44,] 1 12
[45,] 2 12
[46,] 7 12
[47,] 9 12
[48,] 15 12
[49,] 3 13
[50,] 1 14
[51,] 11 14
[52,] 14 15
[53,] 7 16
[54,] 3 17
[55,] 3 18
[56,] 13 18
set.seed(5)
plot(samplk1, main="Sample 1")
plot(samplk2, main="Sample 2")
plot(samplk3, main="Sample 3")
These are dense, heavily connected networks. There appears to be mutual ties between the edges and a high level of transitivity. There also appears to be little variation in the number of edges in a model. Again, I will start with a similar model and add in additional endogenous effects.
sim.hga <- list(samplk1, samplk2, samplk3)
tergm.4 <- btergm(sim.hga ~ edges + triangles)
No covariates provided.
All networks are conformable.
Starting pseudolikelihood estimation with 500 bootstrapping replications on a single computing core...
Done.
summary(tergm.4)
==========================
Summary of model fit
==========================
Formula: sim.hga ~ edges + triangles
Time steps: 3
Bootstrapping sample size: 500
Estimates and 95% confidence intervals:
Estimate 2.5% 97.5%
edges -1.89787 -2.3206 -1.3289
triangle 0.18059 -0.1016 0.3513
tergm.gof.4 <- gof(tergm.4, statistics = c(esp, dsp, geodesic,deg, triad.undirected, walktrap.modularity))
Starting GOF assessment on a single computing core....
No covariates provided.
All networks are conformable.
No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.
Simulating 100 networks from the following formula:
sim.hga[[1]] ~ edges + triangles
Simulating 100 networks from the following formula:
sim.hga[[2]] ~ edges + triangles
Simulating 100 networks from the following formula:
sim.hga[[3]] ~ edges + triangles
3 networks from which simulations are drawn were provided.
Processing statistic: Edge-wise shared partners
Processing statistic: Dyad-wise shared partners
Processing statistic: Geodesic distances
Processing statistic: Degree
Processing statistic: Triad census
Processing statistic: Modularity (walktrap)
plot(tergm.gof.4)
The first TERGM had a really bad fit on the data. I decided to add in more endogenous effects to the model.
sim.hga <- list(samplk1, samplk2, samplk3)
tergm.5 <- btergm(sim.hga ~ edges + triangles
+ transitiveties
+ ctriple
+ memory(type="stability")
, R=100)
Initial dimensions of the network and covariates:
t=2 t=3
sim.hga (row) 18 18
sim.hga (col) 18 18
memory (row) 18 18
memory (col) 18 18
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3
sim.hga (row) 18 18
sim.hga (col) 18 18
memory (row) 18 18
memory (col) 18 18
Starting pseudolikelihood estimation with 100 bootstrapping replications on a single computing core...
Done.
summary(tergm.5)
==========================
Summary of model fit
==========================
Formula: sim.hga ~ edges + triangles + transitiveties + ctriple + memory(type = "stability")
Time steps: 2
Bootstrapping sample size: 100
Estimates and 95% confidence intervals:
Estimate 2.5% 97.5%
edges -1.438593 -1.5732 -1.3093
triangle 0.240770 0.1910 0.3020
transitiveties 0.055347 -0.2215 0.3583
ctriple -0.210097 -0.3510 -0.1657
edgecov.memory[[i]] 1.514495 1.4056 1.6433
tergm.gof.5 <- gof(tergm.5, statistics = c(esp, dsp, geodesic,deg, triad.undirected, walktrap.modularity))
Starting GOF assessment on a single computing core....
Initial dimensions of the network and covariates:
t=2 t=3
sim.hga (row) 18 18
sim.hga (col) 18 18
memory (row) 18 18
memory (col) 18 18
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3
sim.hga (row) 18 18
sim.hga (col) 18 18
memory (row) 18 18
memory (col) 18 18
No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.
Simulating 100 networks from the following formula:
sim.hga[[1]] ~ edges + triangles + transitiveties + ctriple + edgecov(memory[[1]])
Simulating 100 networks from the following formula:
sim.hga[[2]] ~ edges + triangles + transitiveties + ctriple + edgecov(memory[[2]])
2 networks from which simulations are drawn were provided.
Processing statistic: Edge-wise shared partners
Processing statistic: Dyad-wise shared partners
Processing statistic: Geodesic distances
Processing statistic: Degree
Processing statistic: Triad census
Processing statistic: Modularity (walktrap)
plot(tergm.gof.5)
The model was greatly improved by adding in the endogenous effects for triangles, transitiveties, ctriple, and memory. It could still be improved for degree 3, 4, and 5, but it is capturing the overall trends.
sim.hga <- list(samplk1, samplk2, samplk3)
tergm.6 <- btergm(sim.hga ~ edges + triangles
+ idegree(1:3)
# + istar(1:4)
# + ostar(1:4)
+ mutual
+ transitiveties
+ ctriple
+ delrecip
+ memory(type="stability")
, R=100)
Initial dimensions of the network and covariates:
t=2 t=3
sim.hga (row) 18 18
sim.hga (col) 18 18
delrecip (row) 18 18
delrecip (col) 18 18
memory (row) 18 18
memory (col) 18 18
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3
sim.hga (row) 18 18
sim.hga (col) 18 18
delrecip (row) 18 18
delrecip (col) 18 18
memory (row) 18 18
memory (col) 18 18
Starting pseudolikelihood estimation with 100 bootstrapping replications on a single computing core...
Done.
summary(tergm.6)
==========================
Summary of model fit
==========================
Formula: sim.hga ~ edges + triangles + idegree(1:3) + mutual + transitiveties + ctriple + delrecip + memory(type = "stability")
Time steps: 2
Bootstrapping sample size: 100
Estimates and 95% confidence intervals:
Estimate 2.5% 97.5%
edges -1.870042 -2.2592 -1.0427
triangle 0.295525 0.1876 0.3025
idegree1 0.313014 -1.1656 4.1105
idegree2 1.212386 0.7031 3.5088
idegree3 -0.529833 -0.9962 0.9486
mutual 1.208170 1.2082 1.7655
transitiveties 0.035266 -0.1394 0.2145
ctriple -0.563678 -0.6325 -0.2272
edgecov.delrecip[[i]] 0.929730 0.4043 1.1781
edgecov.memory[[i]] 1.288674 1.0455 1.4335
tergm.gof.6 <- gof(tergm.6, statistics = c(esp, dsp, geodesic,deg, triad.undirected, walktrap.modularity))
Starting GOF assessment on a single computing core....
Initial dimensions of the network and covariates:
t=2 t=3
sim.hga (row) 18 18
sim.hga (col) 18 18
delrecip (row) 18 18
delrecip (col) 18 18
memory (row) 18 18
memory (col) 18 18
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3
sim.hga (row) 18 18
sim.hga (col) 18 18
delrecip (row) 18 18
delrecip (col) 18 18
memory (row) 18 18
memory (col) 18 18
No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.
Simulating 100 networks from the following formula:
sim.hga[[1]] ~ edges + triangles + idegree(1:3) + mutual + transitiveties + ctriple + edgecov(delrecip[[1]]) + edgecov(memory[[1]])
Simulating 100 networks from the following formula:
sim.hga[[2]] ~ edges + triangles + idegree(1:3) + mutual + transitiveties + ctriple + edgecov(delrecip[[2]]) + edgecov(memory[[2]])
2 networks from which simulations are drawn were provided.
Processing statistic: Edge-wise shared partners
Processing statistic: Dyad-wise shared partners
Processing statistic: Geodesic distances
Processing statistic: Degree
Processing statistic: Triad census
Processing statistic: Modularity (walktrap)
plot(tergm.gof.6)
I tried a variety of models to improve degree and triad consensus, but the models did not improve. In the fifth TERGM mode, we can see the fit was worse after adding in more endogenous effects. Therefore, I would suggest using the second model because it is more parsimonious and has the best fit.
In addition to the TERGMs I ran above, I decided to run a predictive model for my simulated data using the first four networks to predict the fifth network.
set.seed(12345)
m1 <- btergm(hga[1:4] ~ edges + triangles +
+ mutual + istar(2:3) + ostar(2:3)
#+ delrecip
+ memory(type="stability"))
Initial dimensions of the network and covariates:
t=2 t=3 t=4
hga[1:4] (row) 10 10 10
hga[1:4] (col) 10 10 10
memory (row) 10 10 10
memory (col) 10 10 10
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3 t=4
hga[1:4] (row) 10 10 10
hga[1:4] (col) 10 10 10
memory (row) 10 10 10
memory (col) 10 10 10
Starting pseudolikelihood estimation with 500 bootstrapping replications on a single computing core...
Done.
m1oos <- btergm(hga[1:5] ~ edges + triangles +
+ mutual + istar(2:3) + ostar(2:3)
#+ delrecip
+ memory(type="stability")
, R=100)
Initial dimensions of the network and covariates:
t=2 t=3 t=4 t=5
hga[1:5] (row) 10 10 10 10
hga[1:5] (col) 10 10 10 10
memory (row) 10 10 10 10
memory (col) 10 10 10 10
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3 t=4 t=5
hga[1:5] (row) 10 10 10 10
hga[1:5] (col) 10 10 10 10
memory (row) 10 10 10 10
memory (col) 10 10 10 10
Starting pseudolikelihood estimation with 100 bootstrapping replications on a single computing core...
Done.
summary(m1)
==========================
Summary of model fit
==========================
Formula: hga[1:4] ~ edges + triangles + +mutual + istar(2:3) + ostar(2:3) + memory(type = "stability")
Time steps: 3
Bootstrapping sample size: 500
Estimates and 95% confidence intervals:
Too little variation in the model. 25 replications (5%) are dropped from CI estimation.Error in boot::boot.ci(object@boot, conf = level, type = type, index = x) :
't' must of length 500
The out of sample prediction appears to be decent. Although the GOF for degree and triad census are not perfect, they capture the overall trend. I am a little surprised about the result because the first five models lose five edges per round. This suggests that predictive models may be more flexible than I had anticipated. For the next assignment, I am going to work on simulating a knockout where different network structures lead to different decision making.
As a last exercise, I decided to test out the btergm package with my simulated network data.
test <- mtergm(hga ~ edges + mutual + ttriple
+ transitiveties
# delrecip
+ memory(type="stability"),
control = control.ergm(MCMC.samplesize = 5000, MCMC.interval = 2000))
Initial dimensions of the network and covariates:
t=2 t=3 t=4 t=5 t=6 t=7 t=8 t=9 t=10
hga (row) 10 10 10 10 10 10 10 10 10
hga (col) 10 10 10 10 10 10 10 10 10
memory (row) 10 10 10 10 10 10 10 10 10
memory (col) 10 10 10 10 10 10 10 10 10
All networks are conformable.
Dimensions of the network and covariates after adjustment:
t=2 t=3 t=4 t=5 t=6 t=7 t=8 t=9 t=10
hga (row) 10 10 10 10 10 10 10 10 10
hga (col) 10 10 10 10 10 10 10 10 10
memory (row) 10 10 10 10 10 10 10 10 10
memory (col) 10 10 10 10 10 10 10 10 10
Estimating...
Starting maximum likelihood estimation via MCMLE:
Iteration 1 of at most 20:
The log-likelihood improved by 0.5469
Step length converged once. Increasing MCMC sample size.
Iteration 2 of at most 20:
The log-likelihood improved by 0.05896
Step length converged twice. Stopping.
Evaluating log-likelihood at the estimate. Using 20 bridges: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 .
This model was fit using MCMC. To examine model diagnostics and check for degeneracy, use the mcmc.diagnostics() function.
Done.
summary(test)
==========================
Summary of model fit
==========================
Formula: hga ~ edges + mutual + ttriple + transitiveties + memory(type = "stability")
Time steps: 9
Monte Carlo MLE Results:
Estimate Std. Error t value Pr(>|t|)
edges -0.556717 0.338631 -1.6440 0.100562
mutual -1.958733 0.745184 -2.6285 0.008739 **
ttriple 0.019235 0.488996 0.0393 0.968633
transitiveties -0.136504 0.662315 -0.2061 0.836764
edgecov.memory 3.375390 0.227263 14.8523 < 2.2e-16 ***
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
gof.test<- gof(test,tatistics = c(esp, dsp, geodesic,deg, triad.undirected, walktrap.modularity))
Starting GOF assessment on a single computing core....
No 'target' network(s) provided. Using networks on the left-hand side of the model formula as observed networks.
Simulating 100 networks from the following formula:
networks[[1]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[1]]) + offset(edgecov(offsmat[[1]]))
Simulating 100 networks from the following formula:
networks[[2]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[2]]) + offset(edgecov(offsmat[[2]]))
Simulating 100 networks from the following formula:
networks[[3]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[3]]) + offset(edgecov(offsmat[[3]]))
Simulating 100 networks from the following formula:
networks[[4]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[4]]) + offset(edgecov(offsmat[[4]]))
Simulating 100 networks from the following formula:
networks[[5]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[5]]) + offset(edgecov(offsmat[[5]]))
Simulating 100 networks from the following formula:
networks[[6]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[6]]) + offset(edgecov(offsmat[[6]]))
Simulating 100 networks from the following formula:
networks[[7]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[7]]) + offset(edgecov(offsmat[[7]]))
Simulating 100 networks from the following formula:
networks[[8]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[8]]) + offset(edgecov(offsmat[[8]]))
Simulating 100 networks from the following formula:
networks[[9]] ~ edges + mutual + ttriple + transitiveties + edgecov(memory[[9]]) + offset(edgecov(offsmat[[9]]))
9 networks from which simulations are drawn were provided.
Processing statistic: Dyad-wise shared partners
Processing statistic: Edge-wise shared partners
Processing statistic: Degree
Processing statistic: Indegree
Processing statistic: Geodesic distances
Processing statistic: Tie prediction
Processing statistic: Modularity (walktrap)
plot(gof.test)
The mergm model gives us a similar fit and summary of the data. Similarly, adding in exogenous effets did not improve the fit of the model.