Changes between Version 11 and Version 12 of tergmUsage


Ignore:
Timestamp:
11/10/14 13:36:06 (5 years ago)
Author:
lxwang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • tergmUsage

    v11 v12  
    6969) 
    7070}}} 
     71 
     72=== Constraints and -Inf offsets === 
     73 
     74Constraints may be specified via the constraint formula or a -Inf offset (which prevents ties matching that term from forming). Unless there is real network data, the initial network should be created with {{{san()}} to match the constraints. In the example below, the fitted TERGM model has no male-to-male ties, and the maximum degree is 3. 
     75 
     76{{{ 
     77library(tergm) 
     78nw <- network.initialize(100, directed = FALSE) 
     79nw %v% "male" <- rbinom(100, 1, 0.5) 
     80nw2 <- san(nw ~ edges + nodematch('male'), target.stats=c(80,0),constraints = ~bd(maxout=3) ) 
     81 
     82fit <- stergm(nw2,  
     83              formation = ~edges + offset(nodematch("male")),  
     84              dissolution = ~offset(edges),  
     85              constraints = ~bd(maxout=3), 
     86              target.stats = c(80), 
     87              offset.coef.form = -Inf, 
     88              offset.coef.diss = log(1.5), 
     89              targets = ~edges, 
     90              estimate = "EGMME") 
     91 
     92summary(fit$network ~ nodematch("male")) 
     93fit 
     94 
     95sim <- simulate.stergm(fit, nsim = 1, time.slices = 100, output = "stats", monitor = ~nodematch("male")) 
     96 
     97as.vector(sim) 
     98}}}