# \dontshow{
require(ergm)
GW_helper(1,.5)
# }
# \donttest{
library(ergm)
set.seed(21093)
data("faux.dixon.high")
# fit a model
my.ergm<-ergm(faux.dixon.high~edges+
nodeicov("grade")+
nodeocov("grade")+
nodeifactor("sex")+
nodeofactor("sex")+
absdiff("grade")+
nodematch("sex")+
mutual+
gwidegree(.5,fixed=TRUE))
#for a fixed decay of .5, what is the change statistic for a tie that increases
# degree from 0 to 2?
GW_helper(2,.5)
#for a fixed decay of .5, what is the change statistic for a tie that increases
# degree from 1 to 2?
GW_helper(2,.5,lower_bound=1)
##within a call to ergm.MSE
#creating a single mutual tie requires, at a minimum, increasing indegree
#from 0 to 1 for the recipient node
ergm.MSE(my.ergm,
substructural_effect="mutual",
lower_order_term="gwideg.fixed.0.5",
at.lower_order_term=GW_helper(1,.5),
estimate="MSEm")
#What happens if the tie moves indegree from 4 to 5 for the recipient node?
ergm.MSE(my.ergm,
substructural_effect="mutual",
lower_order_term="gwideg.fixed.0.5",
at.lower_order_term=GW_helper(5,.5,lower_bound=4),
estimate="MSEm")
# }
Run the code above in your browser using DataLab