coef_posterior_density: Plots the posterior density for FERGM model terms.

Description Usage Arguments Value References Examples

View source: R/coef_posterior_density.R

Description

This function allows the users to examine the posterior density of FERGM model terms.

Usage

1
coef_posterior_density(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 prints a list of posterior density plots produced using ggplot2.

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
# load example data
data("ergm.fit")
data("fergm.fit")
data("mesa")

# rstan functions
# Histogram of the posterior
rstan::stan_hist(fergm.fit$stan.fit, par = "beta")
# Density of the posteriors
rstan::stan_dens(fergm.fit$stan.fit, par = "beta")

# We have a cleaner function to look at the posterior densities
densities <- coef_posterior_density(fergm.fit = fergm.fit,
custom_var_names = c("Edges", "Sex Homophily", "Grade Homophily", "Race Homophily",
"GWESP", "Alternating K-Stars"))
densities[[1]]
densities[[2]]

fergm documentation built on May 2, 2019, 2:37 a.m.