clean_summary: Clean posterior description of FERGM.

View source: R/clean_summary.R

clean_summaryR Documentation

Clean posterior description of FERGM.

Description

This function takes a stan object and return a clean summary of the posterior distribution.

Usage

clean_summary(fergm.fit = NULL, custom_var_names = NULL)

Arguments

fergm.fit

A model object returned by the fergm function. Must be specified.

custom_var_names

A vector of custom variable names used in presentation that match the order of the form object passed to fergm. If not provided, defaults to names inherited by fergm.fit.

Value

This function returns a matrix summarizing the posterior distribution, including variable names, posterior means, and 95

References

Box-Steffensmeier, Janet M., Dino P. Christenson, and Jason W. Morgan. 2018. “Modeling Unobserved Heterogeneity in Social Networks with the Frailty Exponential Random Graph Model." Political Analysis. (26)1:3-19.

Stan Development Team (2016). RStan: the R interface to Stan. R package version 2.14.1. http://mc-stan.org/.

Examples

## Not run: 
# The fergm.fit$stan.fit object is of class stanfit.
   # We keep it this way such that users can rely upon
   # conventional stan functions for interpretation
   # getting posterior distributions from the fergm

   # Conventional rstan summary call

 # load example data
data("ergm.fit")
data("fergm.fit")
data("mesa")
stan.smry <- summary(fergm.fit$stan.fit)$summary
beta_df <- stan.smry[grep("beta", rownames(stan.smry)),]
est <- round(beta_df[,c(1,4,8)], 3)

  # We have a built in function to do this simply
est <- clean_summary(fergm.fit)
est <- clean_summary(fergm.fit,
custom_var_names = c("Edges", "Sex Homophily", "Grade Homophily",
"Race Homophily", "GWESP", "Alternating K-Stars"))

## End(Not run)

benjamin-w-campbell/fergm documentation built on April 24, 2022, 6:40 a.m.