fergm_beta_traceplot: Plot traceplots for model terms.

Description Usage Arguments Value References Examples

View source: R/fergm_beta_traceplot.R

Description

This function takes a fergm object and plots the time series of each chain per model term using ggplot2.

Usage

1
fergm_beta_traceplot(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 ggplot2 traceplot for the effects of interest.

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
# load example data
data("ergm.fit")
data("fergm.fit")
data("mesa")
# Use rstan's built in traceplot function
trace <- rstan::traceplot(fergm.fit$stan.fit, pars = "beta")
trace

# We have our own version that includes variable names and tidies it up a bit
fergm_beta_traceplot(fergm.fit,
                    custom_var_names =  c("Edges", "Sex Homophily",
                    "Grade Homophily", "Race Homophily", "GWESP", "Alternating K-Stars"))

benjamin-w-campbell/fergm documentation built on Oct. 20, 2018, 1:14 p.m.