Description Usage Arguments Value References Examples

View source: R/compare_predictions.R

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."

1 2 | ```
compare_predictions(ergm.fit = NULL, fergm.fit = NULL, seed = NULL,
replications = 500)
``` |

`ergm.fit` |
A model object returned by the |

`fergm.fit` |
A model object returned by the |

`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. |

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

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/.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
# 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)
``` |

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.