Learn R Programming

broom (version 0.4.0)

ergm_tidiers: Tidying methods for an exponential random graph model

Description

These methods tidy the coefficients of an exponential random graph model estimated with the ergm package into a summary, and construct a one-row glance of the model's statistics. The methods should work with any model that conforms to the ergm class, such as those produced from weighted networks by the ergm.count package.

Usage

## S3 method for class 'ergm':
tidy(x, conf.int = FALSE, conf.level = 0.95,
  exponentiate = FALSE, quick = FALSE, ...)

## S3 method for class 'ergm': glance(x, deviance = FALSE, mcmc = FALSE, ...)

Arguments

x
an ergm object
conf.int
whether to include a confidence interval
conf.level
confidence level of the interval, used only if conf.int=TRUE
exponentiate
whether to exponentiate the coefficient estimates and confidence intervals
quick
whether to compute a smaller and faster version, containing only the term and estimate columns.
...
extra arguments passed to summary.ergm
deviance
whether to report null and residual deviance for the model, along with degrees of freedom; defaults to FALSE
mcmc
whether to report MCMC interval, burn-in and sample size used to estimate the model; defaults to FALSE

Value

  • All tidying methods return a data.frame without rownames. The structure depends on the method chosen.

    tidy.ergm returns one row for each coefficient, with five columns:

  • termThe term in the model being estimated and tested
  • estimateThe estimated coefficient
  • std.errorThe standard error
  • mcmc.errorThe MCMC error
  • p.valueThe two-sided p-value
  • If conf.int=TRUE, it also includes columns for conf.low and conf.high.

    glance.ergm returns a one-row data.frame with the columns

  • independenceWhether the model assumed dyadic independence
  • iterationsThe number of iterations performed before convergence
  • logLikIf applicable, the log-likelihood associated with the model
  • AICThe Akaike Information Criterion
  • BICThe Bayesian Information Criterion
  • If deviance=TRUE, and if the model supports it, the data frame will also contain the columns
  • null.devianceThe null deviance of the model
  • df.nullThe degrees of freedom of the null deviance
  • residual.devianceThe residual deviance of the model
  • df.residualThe degrees of freedom of the residual deviance
  • Last, if mcmc=TRUE, the data frame will also contain the columns
  • MCMC.intervalThe interval used during MCMC estimation
  • MCMC.burninThe burn-in period of the MCMC estimation
  • MCMC.samplesizeThe sample size used during MCMC estimation

Details

There is no augment method for ergm objects.

References

Hunter DR, Handcock MS, Butts CT, Goodreau SM, Morris M (2008b). ergm: A Package to Fit, Simulate and Diagnose Exponential-Family Models for Networks. Journal of Statistical Software, 24(3). http://www.jstatsoft.org/v24/i03/.

See Also

ergm, control.ergm, summary.ergm

Examples

Run this code
if (require("ergm")) {
    # Using the same example as the ergm package
    # Load the Florentine marriage network data
    data(florentine)

    # Fit a model where the propensity to form ties between
    # families depends on the absolute difference in wealth
    gest <- ergm(flomarriage ~ edges + absdiff("wealth"))

    # Show terms, coefficient estimates and errors
    tidy(gest)

    # Show coefficients as odds ratios with a 99\% CI
    tidy(gest, exponentiate = TRUE, conf.int = TRUE, conf.level = 0.99)

    # Take a look at likelihood measures and other
    # control parameters used during MCMC estimation
    glance(gest)
    glance(gest, deviance = TRUE)
    glance(gest, mcmc = TRUE)
}

Run the code above in your browser using DataLab