—
title: “solution”
output: html_document
—
“`{r setup, include=FALSE}
library(knitr)
read_chunk(“hwk6.R”)
knitr::opts_chunk$set(echo = TRUE)
“`
## Part I: Attribute setup
“`{r CA1}
“`
## Part II: CUG and QAP
The null hypothesis is that the assortativity of Type of the given graph
was drawn from the random graphs conditioned on edges.
Because Pr(X>=Obs): 0.003 < 0.05, the null hypothesis is rejected ```{r CB1} ``` The null hypothesis is that the assortativity of Category of the given graph was drawn from the random graphs conditioned on edges. Because Pr(X>=Obs): 0.001 < 0.05, the null hypothesis is rejected ```{r CB2} ``` The null hypothesis is that the observed assortativity of Type was drawn from the distribution of the statistic evaluated (uniformly) on the repeatedly randomly relabeling the input graph. p(f(perm) >= f(d)): 0.002 < 0.05, the null hypothesis is rejected ```{r CB3} ``` The null hypothesis is that the observed assortativity of Category was drawn from the distribution of the statistic evaluated (uniformly) on the repeatedly randomly relabeling the input graph. p(f(perm) >= f(d)): 0.001 < 0.05, the null hypothesis is rejected ```{r CB4} ``` ## Part III: ERGM ```{r D1} ``` ``` # Not run model2 = ergm(net ~ edges + nodematch("Category") + degree(1) ) save(model2, file="model2.Rdata") ``` ```{r D2} ``` ``` # Not run model3 = ergm(net ~ edges + nodematch("Category") + degree(1) + gwesp(cutoff=7)) save(model2, file="model3.Rdata") ``` ```{r D3} ``` ``` # Not run model4 = ergm(net ~ edges + nodemix("Category", base = c(2, 4, 5, 6)) + gwesp(cutoff=7) + degree(2:4)) save(model4, file="model4.Rdata") ``` ```{r D4} ``` ``` # Not run model5 = ergm(net ~ edges + nodemix("Category", base = c(2, 4, 5, 6)) + gwesp(cutoff=7) + degree(2:4), control=control.ergm(MCMC.burnin=100000, MCMC.interval=5000, MCMC.samplesize=2048)) save(model5, file="model5.Rdata") ``` ```{r D5} ``` ## Part IV: ERGM Interpretation ```{r E1} ``` The result shows that the conditional probability of Evil-Evil edge and Fellow-Fellow edge are much larger than other type of edges. In CUG and QAP testing, the assortativity is significant different from random graphs. This result further proves this point.