GW_helper: Function to compute weighted change statistics for...

View source: R/GW_helper.R

GW_helperR Documentation

Function to compute weighted change statistics for geometrically weighted terms.

Description

Computes geometric weights for a pre-specified subgraph count given a known decay parameter. Intended primarily for use with ergm.MSE to simplify specifications for values of lower-order terms.

Usage

GW_helper(term_count,
            decay,
            lower_bound=0)

Arguments

term_count

is the count of subgraphs to which a researcher wants to assign geometric weights. Should be provided as a scalar (single numeric value).

decay

is the decay parameter used to assign geometric weights provided by the researcher.

lower_bound

is the baseline value for the subgraph count when calculating the geometric weights. Default value is 0.

Details

Computes the weighted value to assign to change statistics for a desired subgraph count. term_count corresponds to the subgraph count to assign geometric weights. For example, consider an ERGM specification where triadic effects are specified with a gwesp statistic. GW_helper would be used to determine the change statistic for a given triad count. If the triad count is 2, this would be specified by setting the term_count argument to equal 2 and providing the decay parameter used to estimate the gwesp term in an ergm call. GW_helper would return the change statistic for the gwesp term when a potential tie increases the triad count to a value of 2, weighted by decay.

The lower_bound argument assigns the baseline value for the subgraph count in question. By default, lower_bound is set to 0. This means that, in the above example, if term_count is set to 2, the default behavior of GW_helper is to calculate the weighted change statistic for a gwesp term that increases the number of triangles from 0 to 2. If lower_bound is set to 1 and term_count is set to 3, then GW_helper will calculate the change statistic when increasing the number of triangles from 1 to 3. Since geometrically weighted terms assign diminishing weights for each statistic added, selection of lower_bound and term_count will affect the value of the resulting change statistic in meaningful ways.

If the geometrically weighted term is estimated with fixed decay, decay is the value provided by the researcher within the ergm formula. If the term is estimated without fixed decay, decay is the decay parameter estimate from the data corresponding to a single entry in the ergm summary table parameter vector.

Value

Returns a scalar value reflecting the change statistic for a potential tie that increases the subgraph count captured by a geometrically weighted term by the values assigned to lower_bound and term_count. Intended primarily to facilitate use of ergm.MSE and ergm.msma.

Author(s)

Scott Duxbury, Associate Professor, University of North Carolina–Chapel Hill, Department of Sociology.

References

Duxbury, Scott W. 2025. "Marginal Structural Effects for ERGM" Working paper.

Hunter, David. 2007. "Curved Exponential Family Models for Social Networks" Social Networks.

Examples




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")
  


ergMargins documentation built on June 14, 2025, 1:08 a.m.