compare_predictions {fergm}R Documentation

Compare predictions of ERGM to FERGM.

Description

This function allows you to assess the importance of the frailty term in prediction by comparing the predictive accuracy of an ERGM to an FERGM. Note: Prior to estimating this function, ensure the network object of interest is saved to the global environment and named "net."

Usage

compare_predictions(ergm.fit = NULL, fergm.fit = NULL, seed = NULL,
  replications = 500)

Arguments

ergm.fit

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

fergm.fit

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

seed

An integer that sets the seed for the random number generator to assist in replication. Defaults to a null value for no seed setting.

replications

The number of networks to be simulated to assess predictions. Defaults to 500.

Value

The compare_predictions function returns a matrix reflecting the number of correctly predicted ties for the ERGM and FERGM for each network simulated.

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

# load example data
library(fergm)
data("ergm.fit")
data("fergm.fit")

# Use built in compare_predictions function to compare predictions of ERGM and FERGM,
# few replications due to example
# Make sure "net" is an object defined in the global environment.
net <- ergm.fit$network
predict_out <- compare_predictions(ergm.fit = ergm.fit, fergm.fit = fergm.fit,
                                   replications = 10, seed=12345)

# Use the built in compare_predictions_plot function to examine the densities of
#  correctly predicted ties from the compare_predictions simulations
compare_predictions_plot(predict_out)

# We can also conduct a KS test to determine if the FERGM fit
     # it statistically disginguishable from the ERGM fit
compare_predictions_test(predict_out)

[Package fergm version 1.1.4 Index]