Using Univariate Conditional Uniform Graph Tests
I previously analyzed the network using igraph and statnet, and need to make a decision about which package serves the network best.
Loading the dataset and creating the network to begin my analysis:
set.seed(11)
gd_statnet <- as.network(gd_projection,
directed = FALSE,
bipartite = FALSE,
loops = FALSE,
connected = TRUE)
I am going to load the data frame I saved from the statnet package analysis as well as a dataframe with key comparable results from each package
In the semester assignment, we looked at what to do if we are interested in testing whether or not a specific network property, such as transitivity, is higher in the network we are interested in than we would expect from a random network. To test our network against a null hypothesis, we can use the function cug.test() and set the parameters on which we plan to condition. Possible parameters for this function include: size, edges, and dyad.census for sna/statnet.
Comparing transitivity to null conditional on size
#compare network transitivity to null conditional on size
trans.cug<-cug.test(gd_projection,FUN=gtrans,mode="graph",cmode="size")
trans.cug
Univariate Conditional Uniform Graph Test
Conditioning Method: size
Graph Type: graph
Diagonal Used: FALSE
Replications: 1000
Observed Value: 0.5240964
Pr(X>=Obs): 0.189
Pr(X<=Obs): 0.811
plot(trans.cug)
#inspect CUG test
trans.cug
Univariate Conditional Uniform Graph Test
Conditioning Method: size
Graph Type: graph
Diagonal Used: FALSE
Replications: 1000
Observed Value: 0.5240964
Pr(X>=Obs): 0.189
Pr(X<=Obs): 0.811
#inspect CUG test
cug.t(trans.cug)
[1] 0.8395548
There is a reasonable probability that the observed network transitivity of 0.524 could be randomly generated, conditional only on the size of the network. In this case, I cannot accept the alternative hypothesis that the observed transitivity is higher than would be expected from a random network. In fact, the probability that X <= 0.524 is 19.6% and the probability that x >= 0.524 is 80.4%. The t-stat evaluation tells us that the observed transitivity value is less than 1 standard error away from what we would expect, on average.
Comparing network degree centralization to null conditional on size
#compare network degree centralization to null conditional on size
c.degree.cug <-cug.test(gd_projection,FUN=centralization, FUN.arg=list(FUN=degree, cmode="degree"), mode="graph", cmode="size")
#plot vs simulation results
plot(c.degree.cug)
#inspect CUG test
c.degree.cug
Univariate Conditional Uniform Graph Test
Conditioning Method: size
Graph Type: graph
Diagonal Used: FALSE
Replications: 1000
Observed Value: 5.206522
Pr(X>=Obs): 0
Pr(X<=Obs): 1
#t-stat between observed and simulated networks
cug.t(c.degree.cug)
[1] 101.9499
There is an extremely remote probability that the observed network degree centrality of 5.21 could be randomly generated, conditional only on the size of the network. In this case, I can accept the alternative hypothesis that the observed network degree centrality is higher than would be expected from a random network. .
Comparing network betweenness centralization to null conditional on size
#compare network betweenness centralization to null conditional on size
b.degree.cug <-cug.test(gd_projection,FUN=centralization, FUN.arg=list(FUN=betweenness, cmode="undirected"), mode="graph", cmode="size", reps=100)
#plot vs simulation results
plot(b.degree.cug)
#inspect CUG test
b.degree.cug
Univariate Conditional Uniform Graph Test
Conditioning Method: size
Graph Type: graph
Diagonal Used: FALSE
Replications: 100
Observed Value: 0.3759561
Pr(X>=Obs): 0
Pr(X<=Obs): 1
#t-stat between observed and simulated networks
cug.t(b.degree.cug)
[1] 34.06653
Again, there is an extremely remote probability that the observed betweenness centrality of 0.376 could be randomly generated, conditional only on the size of the network. In this case, I can accept the alternative hypothesis that the observed network degree centrality is higher than would be expected from a random network. This makes sense with the rest of my network evaluations.
Comparing transitivity to null conditional on dyad
t.degree.cug <-cug.test(gd_projection,FUN=gtrans, mode="graph", cmode="dyad", reps=100)
#plot vs simulation results
plot(t.degree.cug)
#inspect CUG test
t.degree.cug
Univariate Conditional Uniform Graph Test
Conditioning Method: dyad.census
Graph Type: graph
Diagonal Used: FALSE
Replications: 100
Observed Value: 0.5240964
Pr(X>=Obs): 0
Pr(X<=Obs): 1
#t-stat between observed and simulated networks
cug.t(t.degree.cug)
[1] 8.463895
Unlike the first evaluation of transitivity on size, this evaluation of transivity on dyad gives a result that is more in line with subsequent calculations.
For my research in particular, I want to look at the measures of centrality and through the different modes of evaluation.
cug_cent_size <- cug.test(gd_statnet,
centralization,
FUN.arg=list(FUN=degree),
mode="graph",
cmode="size")
cug_cent_edge <- cug.test(gd_statnet,
centralization,
FUN.arg=list(FUN=degree),
mode="graph",
cmode="edges")
cug_cent_dyad <- cug.test(gd_statnet,
centralization,
FUN.arg=list(FUN=degree),
mode="graph",
cmode="dyad.census")
degree_centralization <- c(cug_cent_size$obs.stat,
cug_cent_edge$obs.stat,
cug_cent_dyad$obs.stat)
rt_tail <- c(cug_cent_size$pgteobs,
cug_cent_edge$pgteobs,
cug_cent_dyad$pgteobs)
lt_tail <- c(cug_cent_size$plteobs,
cug_cent_edge$plteobs,
cug_cent_dyad$plteobs)
centrality <- cbind(degree_centralization,
rt_tail,
lt_tail)
rownames(centrality) <- c("Size", "Edges", "Dyads")
par(mfrow=c(1,3))
plot(cug_cent_size, main="Centrality \nConditioned on Size" )
plot(cug_cent_edge, main="Centrality \nConditioned on Edges" )
plot(cug_cent_dyad, main="Centrality \nConditioned on Dyads" )
Text and figures are licensed under Creative Commons Attribution CC BY-NC 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Becvar (2022, May 11). Data Analytics and Computational Social Science: Statistical Analysis. Retrieved from http://gratefulnetwork.live/posts/statistics/
BibTeX citation
@misc{becvar2022statistical, author = {Becvar, Kristina}, title = {Data Analytics and Computational Social Science: Statistical Analysis}, url = {http://gratefulnetwork.live/posts/statistics/}, year = {2022} }