Tidy summarizes information about the components of a model. A model component might be a single term in a regression, a single hypothesis, a cluster, or a class. Exactly what tidy considers to be a model component varies cross models but is usually self-evident. If a model has several distinct types of components, you will need to specify which components to return.
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.
# S3 method for ergm tidy(x, conf.int = FALSE, conf.level = 0.95, exponentiate = FALSE, quick = FALSE, ...)
Logical indicating whether or not to include a confidence
interval in the tidied output. Defaults to
The confidence level to use for the confidence interval
Logical indicating whether or not to exponentiate the
the coefficient estimates. This is typical for logistic and multinomial
regressions, but a bad idea if there is no log or logit link. Defaults
Logical indiciating if the only the
Additional arguments to pass to
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/.
tibble::tibble() with columns:
The upper end of a confidence interval for the term under consideration. Included only if `conf.int = TRUE`.
The lower end of a confidence interval for the term under consideration. Included only if `conf.int = TRUE`.
The estimated value of the regression term.
The MCMC error
The two-sided p-value associated with the observed statistic.
The standard error of the regression term.
The name of the regression term.
library(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)#> # A tibble: 2 x 5 #> term estimate std.error mcmc.error p.value #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 edges -2.30 0.402 0 0.0000000791 #> 2 absdiff.wealth 0.0155 0.00616 0 0.0131# Show coefficients as odds ratios with a 99% CI tidy(gest, exponentiate = TRUE, conf.int = TRUE, conf.level = 0.99)#> # A tibble: 2 x 7 #> term estimate std.error mcmc.error p.value conf.low conf.high #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 edges 0.100 0.402 0 0.0000000791 0.0355 0.282 #> 2 absdiff.wealth 1.02 0.00616 0 0.0131 1.000 1.03# Take a look at likelihood measures and other # control parameters used during MCMC estimation glance(gest)#> # A tibble: 1 x 5 #> independence iterations logLik AIC BIC #> <lgl> <int> <dbl> <dbl> <dbl> #> 1 TRUE 4 -51.0 106. 112.glance(gest, deviance = TRUE)#> # A tibble: 1 x 9 #> independence iterations logLik null.deviance df.null residual.devian… #> <lgl> <int> <dbl> <dbl> <dbl> <dbl> #> 1 TRUE 4 -51.0 166. 120 102. #> # ... with 3 more variables: df.residual <dbl>, AIC <dbl>, BIC <dbl>glance(gest, mcmc = TRUE)#> # A tibble: 1 x 8 #> independence iterations logLik AIC BIC MCMC.interval MCMC.burnin #> <lgl> <int> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 TRUE 4 -51.0 106. 112. 1024 16384 #> # ... with 1 more variable: MCMC.samplesize <dbl>