Learn R Programming

broom (version 0.4.3)

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 ergm
tidy(x, conf.int = FALSE, conf.level = 0.95,
  exponentiate = FALSE, quick = FALSE, ...)

# S3 method for 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:

term

The term in the model being estimated and tested

estimate

The estimated coefficient

std.error

The standard error

mcmc.error

The MCMC error

p.value

The 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

independence

Whether the model assumed dyadic independence

iterations

The number of iterations performed before convergence

logLik

If applicable, the log-likelihood associated with the model

AIC

The Akaike Information Criterion

BIC

The Bayesian Information Criterion

If deviance=TRUE, and if the model supports it, the data frame will also contain the columns

null.deviance

The null deviance of the model

df.null

The degrees of freedom of the null deviance

residual.deviance

The residual deviance of the model

df.residual

The degrees of freedom of the residual deviance

Last, if mcmc=TRUE, the data frame will also contain the columns

MCMC.interval

The interval used during MCMC estimation

MCMC.burnin

The burn-in period of the MCMC estimation

MCMC.samplesize

The 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
# NOT RUN {
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