ergmx.N#

ergmx.N(formula, lm=None, subset=None, weights=None, contrasts=None, offset=None, label=None)[source]#

Evaluate formula on each network of ergmx.Networks(), as ergm.multi’s N(): with the default lm, the statistics are sums over the networks.

lm is a one-sided linear model over network-level attributes, in R syntax: "~log(n)", "~I(n <= 3) + weekday", "~0 + factor(.NetworkID)". Each term’s coefficient in a network is the linear model’s prediction: N(~edges, lm=~log(n)) gives N(1)~edges and N(log(n))~edges, the intercept and slope of the edges coefficient in the network size. The attributes are each network’s graph attributes, n (its number of vertices), .NetworkID and .NetworkName. In a formula string: "N(~edges + gwesp(0.5, fixed=TRUE), lm=~log(n))".

subset keeps some networks only: an R expression of their attributes ("~n >= 4"), logical values (recycled) or 1-based indices; the others contribute nothing to the terms, and the linear model’s factor levels are those of the kept networks. offset adds a known amount to every coefficient of the formula in each network (an R expression, such as "~log(n)", or numbers), as do offset() terms in lm: each statistic then gets an extra statistic, offset1, offset2…, whose coefficient is fixed at 1, as in ergm.multi. label names the operator in the statistics’ names (N(label,1)~edges), or, a function of a statistic’s name and a column of the linear model, names them. weights other than 1 and contrasts are not supported, as in ergm.multi.