bergmM | R Documentation |
Function to fit Bayesian exponential random graphs models under missing data using the approximate exchange algorithm.
bergmM(
formula,
burn.in = 100,
main.iters = 1000,
aux.iters = 1000,
prior.mean = NULL,
prior.sigma = NULL,
nchains = NULL,
gamma = 0.5,
V.proposal = 0.0025,
seed = NULL,
startVals = NULL,
offset.coef = NULL,
constraints = NULL,
thin = 1,
saveEveryX = NULL,
cut.reject = TRUE,
saveEveryXName = "partialBergmEstimate.rda",
imputeAllItr = FALSE,
imputeLast = TRUE,
nImp = NULL,
missingUpdate = NULL,
imputeData = NULL,
attributeNames = NULL,
miceIt = 5,
onlyKeepImputation = FALSE,
...
)
formula |
formula; an |
burn.in |
count; number of burn-in iterations for every chain of the population. |
main.iters |
count; number of iterations for every chain of the population. |
aux.iters |
count; number of auxiliary iterations used for network simulation. |
prior.mean |
vector; mean vector of the multivariate Normal prior. By default set to a vector of 0's. Note that several ergm.terms add more than one parameter to the model. You need to adjust your priors accordingly |
prior.sigma |
square matrix; variance/covariance matrix for the multivariate Normal prior. By default set to a diagonal matrix with every diagonal entry equal to 100. Note that several ergm.terms add more than one parameter to the model. You need to adjust your priors accordingly |
nchains |
count; number of chains of the population MCMC. By default set to twice the model dimension (number of model terms). |
gamma |
scalar; parallel adaptive direction sampling move factor. |
V.proposal |
count; diagonal entry for the multivariate Normal proposal. By default set to 0.0025. |
seed |
count; random number seed for the Bergm estimation. |
startVals |
vector; optional starting values for the parameter estimation. |
offset.coef |
vector; a vector of coefficients for the offset terms. |
constraints |
formula;
A formula specifying one or more constraints on the support of the distribution of the networks being modeled, using syntax similar to the formula argument, on the right-hand side. Multiple constraints may be given, separated by “+” and “-” operators. (See |
thin |
count; The thinning interval between consecutive observations. |
saveEveryX |
count; If not NULL, the posterior and obtained imputation (only if nImp > 0) will be saved to your working directory at every X iterations. Note that this slows down estimation and thus X should not be set too low. By default, the saved data will be in 'partialBergmEstimate.rda' and will be overwritten every X iterations and by other calls of bergm() or bergmM(). |
cut.reject |
logical; default TRUE. By default bergm()/bergmM() will save the last accepted theta to the posterior if the new proposal is rejected. This artificially will increase the auto-correlation of consecutive parameters. |
saveEveryXName |
character; the Name of the partial estimation object. If you run multiple bergm()/bergmM() calls in the same working directory you should change this name so that the calls do not override each other. |
imputeAllItr |
logical; default FALSE. If TRUE, missing network and attribute data are imputed after every iteration. This leads to much (!!!) longer estimation times, but potentially overall better estimation. It is recommended to initially estimate with imputeAllItr = FALSE to get reasonable starting values and reduce overall estimation time. |
imputeLast |
logical; default TRUE and in line with Koskinen et al. 2010. If FALSE, network imputations will be performed with a random draw from the so far accepted parameter values. |
nImp |
count; number of imputed networks to be returned. If null, no imputed network will be returned. |
missingUpdate |
count; number of tie updates in each imputation step. By default equal to the number of missing ties. Smaller numbers increase speed. Larger numbers lead to better sampling. |
imputeData |
data.frame; a data.frame with all attribute variables that should be imputed and additional attributes that should be used for the imputation. All non-numeric variables need to be specified as.factors. Names of vertex.attributes and variable names need to be identical. |
attributeNames |
character vector,
a vector with the names of all variables that need to be imputed.
These names need to be identical with the vertex.attributes and must be part of the names of the |
miceIt |
count, number of iterations in the MICE imputation. Default is 5. |
onlyKeepImputation |
logical, Should only imputations be returned, and no bergm estimate (only recommended after you made sure that the model estimates properly). |
... |
additional arguments, to be passed to lower-level functions. |
Caimo, A. and Friel, N. (2011), "Bayesian Inference for Exponential Random Graph Models," Social Networks, 33(1), 41-55. https://arxiv.org/abs/1007.5192
Caimo, A. and Friel, N. (2014), "Bergm: Bayesian Exponential Random Graphs in R," Journal of Statistical Software, 61(2), 1-25. https://www.jstatsoft.org/v61/i02
Koskinen, J.H., Robins, G.L., and Pattison, P.E. (2010), "Analysing exponential random graph (p-star) models with missing data using Bayesian data augmentation," Statistical Methodology 7(3), 366-384.
Krause, R.W., Huisman, M., Steglich, C., and Snijders, T.A. (2020), "Missing data in cross-sectional networks-An extensive comparison of missing data treatment methods", Social Networks 62: 99-112.
## Not run:
# Load the florentine marriage network
data(florentine)
# Create missing data
set.seed(14021994)
n <- dim(flomarriage[, ])[1]
missNode <- sample(1:n, 1)
flomarriage[missNode, ] <- NA
flomarriage[, missNode] <- NA
# Posterior parameter estimation:
m.flo <- bergmM(flomarriage ~ edges + kstar(2),
burn.in = 50,
aux.iters = 500,
main.iters = 1000,
gamma = 1.2,
nImp = 5)
# Posterior summaries:
summary(m.flo)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.