Learn R Programming

GERGM (version 0.6.2)

gergm: A Function to estimate a GERGM.

Description

The main function provided by the package.

Usage

gergm(formula, covariate_data = NULL, normalization_type = c("log",
  "division"), network_is_directed = c(TRUE, FALSE),
  use_MPLE_only = c(FALSE, TRUE), transformation_type = c("Cauchy",
  "LogCauchy", "Gaussian", "LogNormal"), estimation_method = c("Gibbs",
  "Metropolis"), maximum_number_of_lambda_updates = 10,
  maximum_number_of_theta_updates = 10,
  number_of_networks_to_simulate = 500, thin = 1, proposal_variance = 0.1,
  downweight_statistics_together = TRUE, MCMC_burnin = 100, seed = 123,
  convergence_tolerance = 0.01, MPLE_gain_factor = 0,
  acceptable_fit_p_value_threshold = 0.05, force_x_theta_updates = 1,
  force_x_lambda_updates = 1, output_directory = NULL, output_name = NULL,
  generate_plots = TRUE, verbose = TRUE, omit_intercept_term = FALSE, ...)

Arguments

formula
A formula object that specifies the relationship between statistics and the observed network. Currently, the user may specify a model using any combination of the following statistics: `out2stars(alpha = 1)`, `in2stars(alpha = 1)`, `ctriads(alpha = 1)`,
covariate_data
A data frame containing node level covariates the user wished to transform into sender or reciever effects. It must have row names that match every entry in colnames(raw_network), should have descriptive column names. If left NULL, then no sender or reci
normalization_type
If only a raw_network is provided and omit_intercept_term = TRUE then, the function will automatically check to determine if all edges fall in the [0,1] interval. If edges are determined to fall outside of this interval, then a trasformation onto the inte
network_is_directed
Logical specifying whether or not the observed network is directed. Default is TRUE.
use_MPLE_only
Logical specifying whether or not only the maximum pseudo likelihood estimates should be obtained. In this case, no simulations will be performed. Default is FALSE.
transformation_type
Specifies how covariates are transformed onto the raw network. When working with heavly tailed data that are not strictly positive, select "Cauchy" to transform the data using a Cauchy distribution. If data are strictly positive and heavy tailed (such as
estimation_method
Simulation method for MCMC estimation. Default is "Gibbs" which will generally be faster with well behaved networks but will not allow for exponential downweighting.
maximum_number_of_lambda_updates
Maximum number of iterations of outer MCMC loop which alternately estimates transform parameters and ERGM parameters. In the case that data_transformation = NULL, this argument is ignored. Default is 10.
maximum_number_of_theta_updates
Maximum number of iterations within the MCMC inner loop which estimates the ERGM parameters. Default is 100.
number_of_networks_to_simulate
Number of simulations generated for estimation via MCMC. Default is 500.
thin
The proportion of samples that are kept from each simulation. For example, thin = 1/200 will keep every 200th network in the overall simulated sample. Default is 1.
proposal_variance
The variance specified for the Metropolis Hastings simulation method. This parameter is inversely proportional to the average acceptance rate of the M-H sampler and should be adjusted so that the average acceptance rate is approximately 0.25. Default is 0
downweight_statistics_together
Logical specifying whether or not the weights should be applied inside or outside the sum. Default is TRUE and user should not select FALSE under normal circumstances.
MCMC_burnin
Number of samples from the MCMC simulation procedure that will be discarded before drawing the samples used for estimation. Default is 100.
seed
Seed used for reproducibility. Default is 123.
convergence_tolerance
Threshold designated for stopping criterion. If the difference of parameter estimates from one iteration to the next all have a p -value (under a paired t-test) greater than this value, the parameter estimates are declared to have converged. Default is 0.
MPLE_gain_factor
Multiplicative constant between 0 and 1 that controls how far away the initial theta estimates will be from the standard MPLEs via a one step Fisher update. In the case of strongly dependent data, it is suggested to use a value of 0.10. Default is 0.
acceptable_fit_p_value_threshold
A p-value threshold for how closely statistics of observed network conform to statistics of networks simulated from GERGM parameterized by converged final parameter estimates. Default value is 0.05.
force_x_theta_updates
Defaults to 1 where theta estimation is not allowed to converge until thetas have updated for x iterations . Useful when model is not degenerate but simulated statistics do not match observed network well when algorithm stops after first y updates.
force_x_lambda_updates
Defaults to 1 where lambda estimation is not allowed to converge until lambdas have updated for x iterations . Useful when model is not degenerate but simulated statistics do not match observed network well when algorithm stops after first y updates.
output_directory
The directory where you would like output generated by the GERGM estimation proceedure to be saved (if output_name is specified). This includes, GOF, trace, and parameter estimate plots, as well as a summary of the estimation proceedure and an .Rdata file
output_name
The common name stem you would like to assign to all objects output by the gergm function. Default value of NULL will not save any output directly to .pdf files, it will be printed to the console instead. Must be a character string or NULL. For example, i
generate_plots
Defaults to TRUE, if FALSE, then no diagnostic or parameter plots are generated.
verbose
Defaults to TRUE (providing lots of output while model is running). Can be set to FALSE if the user wishes to see less output.
omit_intercept_term
Defualts to FALSE, can be set to TRUE if the user wishes to omit the model intercept term.
...
Optional arguments, currently unsupported.

Value

  • A gergm object containing parameter estimates.

Examples

Run this code
set.seed(12345)
net <- matrix(rnorm(100,0,20),10,10)
colnames(net) <- rownames(net) <- letters[1:10]
formula <- net ~  mutual + ttriads

test <- gergm(formula,
              normalization_type = "division",
              network_is_directed = TRUE,
              use_MPLE_only = FALSE,
              estimation_method = "Metropolis",
              number_of_networks_to_simulate = 40000,
              thin = 1/10,
              proposal_variance = 0.5,
              downweight_statistics_together = TRUE,
              MCMC_burnin = 10000,
              seed = 456,
              convergence_tolerance = 0.01,
              MPLE_gain_factor = 0,
              force_x_theta_updates = 4)

Run the code above in your browser using DataLab