Resources: EUTcommands.R

File EUTcommands.R, 650 bytes (added by lxwang, 5 years ago)
Line 
1
2
3msmnet <- network.initialize(1000,directed=F)
4
5#0 30%
6#1 50%
7#2 10%
8#3  5%
9#4  4%
10#5  1%
11
12#(500 + 200 + 150 + 160 + 50)/2 = 1060/2 =530
13
14msm.fit <- ergm(msmnet~edges+degree(1:4),target.stats=c(530,500,100,50,40),constraints=~bd(maxout=5))
15msm.sim <- simulate(msm.fit,nsim=10000,control=control.simulate.ergm(MCMC.interval=1e3),monitor=~degcor,statsonly=T)
16colMeans(msm.sim)
17
18
19
20
21msm.race.net <- network.initialize(1000,directed=T)
22msm.race.net <- set.vertex.attribute(msm.race.net,"race",c(rep("B",500),rep("W",500)))
23msm.race.target.stats <- c(300,400,500,200)
24msm.race.fit <- ergm(msm.race.net~nodemix("race"),target.stats=msm.race.target.stats)