clean_summary: Clean posterior description of FERGM.

Description Usage Arguments Value References Examples

View source: R/clean_summary.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## 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 Oct. 4, 2018, 9:11 p.m.