NEWS | R Documentation |
ergm
packageAdded message to notify when ergm MCMLE does not converge after max iterations.
Copied the combined Sampson monks dataset to ergm. See ?sampson
.
ergm simulation, bridge, and logLik functions now "inherit" the parallel setting from the ergm object and generally pass it along when possible.
A new estimate type and source for initial values, contrastive divergence, has been added. It is intended primarily for obtaining initial values for MCMLE for valued ERGMs and ERGMs with complex (e.g., degree and edge-count) constraints. For binary networks with dyad-independent constraints, MPLE still generally works better and remains the default.
To obtain the contrastive divergence estimate, call
ergm
with estimate="CD"
.
Fixed issue where constraints was not appropriately compared to older version
Fixed bug where the deviance of dyad-independence models was incorrectly computed/reported for all models
Removed Rglpk
package dependency; replaced it with lpSolve
package dependency. See man page for is.inCH
for details
Fixed integer overflow bug in sample size reporting
Fixed bug in saving target.stats vector. Offset terms in target.stats output are now NA instead of the SAN network stats. (issue #1049)
Fixed ergm segfault when unknown node attributes are used in ergm formulas. Modified get.node.attr function so that it will check if specified attribute exists. (previous code only checked if network was bipartite). (issue #1140, reported by Philip Leifeld)
Implemented solution to MCMLE steplength getting stuck at 0 for some models where initial networks are very far from target stats. If the Hummel step length is < control$MCMLE.steplength.min, stop with an informative error message, reporting that the the starting value is poor. If using target stats, it try increasing SAN parameters, or your configuration may be impossible or unlikely. (This suggests a poor model for the observed data.) MCMLE.steplength.min=0.0001 by default. Estimation will stop with an error message when steplen is smaller than the min for 2 iterations. (issue #1089)
Replaced the integer function abs() by floating point function fabs() in MHproposals_degree.c.
Various documentation corrections and fixes
ergm
with estimate="MPLE"
will now
refuse to estimate the MPLE for valued ERGMs, curved ERGMs, and ERGMs with
certain complex constraints, as true MPLE
for these is not yet implemented.
CRAN-requested code structure changes (generally not visable to user):
require
and library
calls changed to requireNamespace
and namespace prefixes added to calls from other packages,
S3 methods explicitly registered in NAMESPACE
.
packageDescription
is no longer used in package citation methods.
Many formerly 'internal' functions have been documented in a semi-stable API for use by developers of other ergm-related packages.
Many formerly undocumented 'internal' functions have been made internal by the NAMESPACE
. As far as we know, this avoids functions in use by reverse-Depending packages. These currently appear as commented items in the NAMESPACE
file.
Many undocumented 'internal' functions that do not appear to be used have been deprecated and will likely be removed in the next release. See ?ergm_deprecated
for a list. If called, these functions will give a Deprecation warning and suggest an alternate function where appropriate.
ergm MCMLE estimation, by default, uses the stepping algorithm by Hummel et al (2012) to determine step length, and terminates estimation when the step length = 1 for two consecutive iterations. The old method (from version 3.1) is still available by setting control parameter MCMLE.termination="Hotelling"
.
As a result of using Hummel stepping algorithm, the final MCMC sample average may be different from the observed statistics. This is reflected in mcmc.diagnostics()
: these plots can no longer be used to ensure that the mean statistics from the model match the observed network statistics. For that functionality, please use the GOF command: gof(object, GOF=~model)
.
Default ergm MCMC parameters changed to MCMC.interval=1024, MCMC.samplesize=1024, MCMC.burnin=MCMC.interval*16
. The final sample size in the Hummel stepping algorithm is boosted by a factor of MCMLE.last.boost
Default values for a number of other control parameters have changed, see CHANGES below.
Parallel functionality: ergm can take user-created clusters as the parallel control parameter. This is the recommended method for using ergm on a high-performance computing cluster. See ergm-parallel. Functionality now implemented via the parallel
package, direct dependence on snow
package is removed
New helper function search.ergmTerms()
function which through the ergm.terms
help page and prints out a list of terms appropriate for the specified network's structural constraints, optionally restricting by additional categories and keyword matches.
The estimated covariance matrix of the ergm estimate can be extracted using vcov
function.
New EXPERIMENTAL Effective Sample Size (ESS) feature to adaptively determine MCMC length needed to get the specified effective size. Set MCMC.effectiveSize
to non-NULL to enable this functionality; 50 is a reasonable value. Includes new ergm.control
parameters
MCMC.effectiveSize=NULL
MCMC.effectiveSize.damp=10
MCMC.effectiveSize.maxruns=1000
MCMC.effectiveSize.base=1/2
MCMC.effectiveSize.points=5
MCMC.effectiveSize.order=0.1
MCMLE.MCMC.max.ESS.frac
SAN.control now includes an MPLE.max.dyad.types
parameter which defaults to the value of the ergm.control parameter of the same name.
Addition of the StdNormal
reference distribution. See ?ergm.references
New ergm terms:
b1mindegree, b2mindegree
Minimum degree for the designated mode in a bipartite network
b1nodematch, b2nodematch
Nodal attribute-based homophily effect for the designated mode in a bipartite network.
Additional arguments added to the network.update
function to control which attributes and properties are updated.
new esteq
argument for simulate.formula
and simulate.ergm
: Default is FALSE. If TRUE, compute the sample estimating equations of an ERGM. If the model is linear, all non-offset statistics are passed. If the model is curved, the score estimating equations (3.1) by Hunter and Handcock (2006) are given instead.
New and expanded tests of the ergm functions for use with R CMD CHECK tools.
Addition of is.durational
methods for models and formulas. These functions test whether the terms in an ERGM model or formula is duration dependent or not. If the formula or model does not include any terms that need information about the duration of existing ties, the ergm process can use more efficient internal data structures. This is mostly in support of tergm
functionality.
New ergm constraint terms: fixallbut(free.dyads)
, fixedas(present,absent)
. The former one can specify the set of dyads (as an edgelist or a network object) to be fixed, the latter one can specify two sets of dyads (as edgelists or networks objects), to be fixed present and fixed absent respectively. See ?ergm.constraints
Potential speed/memory usage improvement: sampling algorithms in both R can C levels are optimized.
ergm now imports the network
package via NAMESPACE to avoid internal namespace collisions when used with iGraph
MCMC control parameters changes in control.ergm
default for MCMC.interval
increased from 100 to 1000
default for MCMC.burnin
changed from 10000 to mcmc.interval*16
default for MCMC.samplesize
decreased from 10000 to 1024
MCMLE control parameter changes in control.ergm
a new control argument MCMLE.termination
has been added to specify the criterion used for terminating MCMLE estimation.
a new MCMLE.metric
argument 'logtaylor'
has been added
control parameter MCMCLE.steplength.margin
has been added
default value for MCMLE.MCMC.precision
has been increased from 0.05 to 0.005
default value for MCMLE.steplength
has been changed from 0.5 to 1
ergm.control parameter SA.nsubphases
default changed from MCMLE.maxit to 4
control.gof parameter MCMC.burnin
default increased from 1000 to 10000
similarly, the default for the MCMC.burnin
control parameter for control.simulate
, control.simulate.formula
and control.simulate.formula.ergm
increased from 1000 to 10000
Networks where some statistics are at the lowest value, leading to some terms being -Inf, was not giving the correct estimated coefficients. Now fixed.
Bug fix in Penalized-likelihood MPLE estimation
Bug fix in MPLE estimation when ergm edgecov term has an attribute as a matrix.
Bug fix in ergm nodecov term when attributes are specified only for the second mode in a bipartite network
Various compatibility improvements to avoid warnings from R 3.1.2 and 3.1.3
control parameter MPLE.max.dyad.types
is now passed to logLik.ergm()
and ergm.bridge.dindstart.llk()
.
fixes issue reported by Sebastian Daza
Fixed a fencepost bug in ergm.bridge.dindstart.llk()
's construction of the offset coefficient vector in the dyad-independent submodel reported by Philip Leifeld
Adjusted package initialization code to avoid throwing error reported by Philip Leifeld when ergm imported by another package instead of attached to workspace.
Fixed a bug with ergm.pl
not dropping the appropriate rows when there are Infs. When network stats are 0, the glm model should now be specified correctly. Reported by Kevin Lewis
Many other fixes...
The ergm control parameter MCMLE.method
has been deprecated. By default, ergm uses trust
, and falls back to optim
with Nelder-Mead method when trust
fails.
The ergm control parameter MCMLE.adaptive.epsilon
has been removed.
The ergm control parameters MCMC.burnin.retries
, MCMC.burnin.check.last
and MCMC.burnin.check.alpha
have been removed.
MCMLE.adaptive.epsilon
parameter has been removed
The faux.high
dataset was removed as it was identical to faux.mesa.high
The "iterations" output in an ergm object now returns the number of MCMLE iterations taken by the estimation.
New help page for ergm MetropolisHastings Proposal methods.
An array bounds issue was fixed in the C
code. It has not affected any previous output.
Some spurious convergence warnings are no longer printed by
summary.ergm
.
Bugs in the valued Uniform and Discrete Uniform Metropolis-Hastings proposals for missing dyads have been fixed.
Term edgecov
invoked with the network
attribute syntax now checks for the presence of the network
attribute in question.
Calling ergm
, with estimate="MPLE"
for
a curved exponential family model (e.g., gwesp
with
fixed=FALSE
) is now an error. (Previously, it treated the
curved term as fixed, which was misleading.)
ergmMPLE
can now output an array of change
scores associated with each dyad. See the help page for more
details.
Some Metropolis-Hastings proposal functions would sometimes
return incorrect acceptance probabilities when combined with the
bd
constraint. This has been
fixed.
In simulate.ergm
and
simulate.formula
, some combinations of
control$parallel
, statsonly
, and sequential
arguments would cause an error. This has been fixed. Note that the
current implementation of parallel simulation when
statsonly=FALSE
or sequential=FALSE
is very
inefficient.
A namespace bug in the likelihod calculation code, reported by Matthew Hoover, has been fixed.
MPLE for some degree-based constraints has been reenabled.
Argument fitmodel
to ergmMPLE
has been
deprecated in favor of output
.
Default SAN.burnin
control parameter has been
increased to 100,000.
Long-standing bugs in MCMC standard error calculation have been fixed. In particular, MCMC standard errors are now calculated for offset models, and they are no longer overestimated (by too much).
san
now behaves sensibly when the network exceeds the
number of edges allocated.
degrange
terms now initialize correctly for their
respective network types.
Some spurious warnings are no longer printed.
A variety of minor errors has been fixed.
ergm
's implementation and tests now work with
network
version 1.8. (In
particular, bipartite=0
is now treated as a network with no
actors.)
Infrastructure
has been added for fitting valued ERGMs of Krivitsky (2012). The
“user interface” is subject to change, however. (The
implementation of reference measures for counts can be found in R package
ergm.count
)
ergm
itself now includes
rudimentary implementations for discrete uniform and continuous
uniform reference measures. See help('ergm-references')
.
A large number of ERGM terms for counts have been
implemented and documented. See help('ergm-terms')
.
A number of new binary ERGM terms have been
implemented as well. Particularly, degrange
,
odegrange
, idegrange
,
b1degrange
, and b2degrange
, which
generalize degree
and concurrent
by
allowing the user to specify contiguous ranges of degree values.
A rudimentary “degeneracy” heuristic has been
implemented and enabled by default, immediately stopping MC MLE
optimization if simulating from a parameter configuration of
interest encounters produces networks with too many edges. See
MCMLE.density.guard
argument in control.ergm
documentation for details. Note that this is intended mainly to
keep the fitting from bogging down on bad models, and it should
not be used as a formal degeneracy diagnostic.
ergm
now keeps track of of when
it is and when it's not possible to evaluate the likelihood of the
null model (a model with no terms), and takes into account whether
a model is constrained, has missing dyads, etc.. This can also
improve the MPLE.
A new generic, logLikNull
has been added that
returns the null model likelihood.
For models where this is not possible, the null likelihood (and deviance, etc.) is defined to be 0.
A new constraint, blockdiag
has been added, for
modeling networks with only within-block ties allowed. This is
useful for, e.g., fitting an ERGM to several networks jointly. See
? 'ergm-constraints'
for available constraints.
The implementation of dynamic network models has been moved to a
new package, tergm
.
Sample space constraints degrees
,
idegrees
, odegrees
,
b1degrees
, b2degrees
have
been re-implemented or fixed.
Certain functions are now only exported if they haven't
already be defined (e.g., by
latentnet
).
Documentation and citation information have been cleaned up
and reorganized. In particular, see ? 'ergm-constraints'
,
? 'ergm-terms'
for an article on terms, and ?
'ergm-references'
for reference measures implemented.
ergm
now exports header and
stub files for the LinkingTo:
API, and package
ergm.userterms
now uses it. Please see
inst/include/README
before using it, however.
Dynamic network modeling code has been moved to
tergm
package.
Function statnet.edit
has been removed.
Some bugs introduced by the developers relying on a certain
behavior of the .C
API which had changed have been
fixed.
Some undocumented terms have been fixed and documented,
including odegreepopularity
,
idegreepopularity
, degreepopularity
,
and smalldiff
.
Facilities for fitting and simulating Separable Temporal
ERGMs (STERGMs) of Krivitsky (2009) and, Krivitsky and Handcock
(2010) have been added. See stergm
and
simulate
.
ergm
MCMLE will now test if the optimization
has converged to the MLE and stop if it detects convergence.
ergm
Now checks if a constraint specified in
the constraints
argument fixes any statistics in the
model (e.g., ergm(y~edges, constraints=~edges)
). It issues a
warning, and fixes their parameters at 0.
simulate
functions now take an argument
monitor
, a one-sided formula for additional statistics to
be returned. This allows one to easily simulate from an
ergm
or stergm
fit statistics that
were not in the fitted model.
ergm
can now optionally detect when a burn-in
is insufficient and retry it until it is sufficient. See
control.ergm
argument MCMC.burnin.retries
for
details.
ergm
MCMLE now stores “history” of
θ and simulated statistics.
ergm
extreme statistics detection (if
control.ergm(drop=TRUE)
) can now detect both extremely high
and extremely low values, setting the coefficients to +Inf and
-Inf respectively. Direction of “dropping” is returned.
An initial method "zeros"
has been, to use a vector
of zeros as starting parameters.
A number of new ERGM terms have been added.
ergm
, simulate
,
and other functions now enforce a conceptual separation between
what to fit, which is controlled by arguments to the
function and how to fit it, which is controlled by the
control
lists, generated by control.ergm
and
control.simulate
, respectively. (Old arguments for
ergm
and simulate
still work with a warning, and
they may be removed later.)
The data structure returned by
simulate
is now a list of networks
with attr
-style attributes describing how it was
generated. The list has print and summary methods, and it can be
used in the left-hand side of a
summary
formula.
Matrices of sample statistics returned by ergm
are mcmc
objects (or
mcmc.list
objects, for parallel computing).
Arguments theta
have been renamed to
coef
. Arguments meanstats
have been renamed to
target.stats
. Many control parameters have also been
renamed and reorganized. (Old parameters still work with a
warning, and they may be removed later.)
A number of arguments to control.ergm
,
control.simulate
, and others, have been renamed.
ergm
now uses bridge sampling evaluate the
log-likelihood by default. (Before, the default was to not
evaluate it.)
mcmc.diagnostics
has been
rewritten:
Raftery-Lewis diagnostic has been replaced with several others, including tests of (non)convergence.
For fits with missing data, diagnostics for both the constrained and the unconstrained sample are printed and plotted.
Plots now use lattice
graphics, if available.
Handling of networks with many edges has been improved somewhat.
gof.ergm
and gof.formula
now set
the statistics used to diagnose the fit adaptively, depending on
the directedness of the network being modeled.
The following control parameters have been removed or
renamed:
maxedges
, prop.weights
, prop.args
,
packagename
, summarizestats
, nr.maxit
,
nr.reltol
, maxNumDyadTypes
,
steplength
, initialfit
, style
,
obs.MCMCsamplesize
, obs.interval
, obs.burnin
,
compress
, metric
, force.mcmc
,
adaptive.trustregion
, adaptive.epsilon
,
mcmc.precision
, method
, MPLEtype
,
check.degeneracy
, maxMPLEsamplesize
,
MPLEsamplesize
, phase1_n
, nsubphases
,
RobMon.phase1n_base
, RobMon.phase2n_base
,
RobMon.phase2sub
, RobMon.init_gain
,
RobMon.phase3n
, trustregion
, stepMCMCsize
,
steppingmaxit
, gridsize
, sequential
,
returnMCMCstats
, calc.mcmc.se
, hessian
,
prop.weights
, prop.args
, and packagenames
.
The following arguments to functions have been moved to the
corresponding control functions, removed or renamed:
burnin
, MCMCsamplesize
, interval
,
maxit
, seed
, and theta0
.
Fixed some errors in log-likelihood calculation, especially in models with missing data and/or offset terms.
Parallel processing has been made more robust. In
particular, ergm
now checks to make
sure that the version it finds on slave nodes is the same as the
version on the master. Also, although ergm
will
start its own cluster as needed, it will also detect if an MPI
cluster has already been started and use that.
Several bugs relating to handling models with with offset terms have been fixed.
The bounded degree (bd
) ERGM would sometimes tabulate
degrees incorrectly. This has been fixed.
Miscellaneous robustification and bug fixes.
The “news” feature has been implemented. Type
news(package="ergm")
to see the version's updates.
A function ergm.allstats
was added to
calculate all possible network statistics for a given ERGM and
network. The number of possible networks grows on the order of 2^{n^2}, so this should only be used for small networks. Related function ergm.exact
calculates exact log-likelihood for a particular canonical parameter and a particular ergm.
A cutoff
argument has been added to specify maximum shared partner
count or degree to be evaluated to the following model terms:
gwb1degree
, gwb2degree
, gwdegree
, gwdsp
, gwesp
, gwidegree
, gwnsp
,
gwodegree
. This significantly speeds up fitting
curved ERGMs on large, sparse networks.
The logLik
method for
ergm
objects, with the attendant AIC
and BIC
methods, has been implemented.
Calculation of loglikelihoods for MCMC-based ergm fits has
been reengineered to use bridge sampling for dyad-dependent
models. (See logLik.ergm
,
ergm.bridge.llr
, and
ergm.bridge.dindstart.llk
.)
A generic function is.dyad.independent
to test
whether an ERGM fit or formula is dyad-independent has been added.
A generic function fix.curved
to convert
curved exponential family models to variants in which the curved
parameters are fixed has been added. See the function
documentation for usage scenarios.
A generic function enformulate
function to
work around a current limitation in the ergm
function to substitute curved parameters from a model fit into the
model formula, allowing them to be used as initial values (the
theta0
argument). See the function documentation for usage
scenarios.
The following new models terms have been added:
degcrossprod
and degcor
.
Tests for change statistics have been added.
A new dataset has been added: kapferer
, the well-known
tailor shop network dataset of Kapferer (1972).
The package has been “standardized” to represent
directed ties as (tail,head)
.
Log-likelihood calculation for dyad-dependent models has been fixed.
Some errors in estimating parameters in curved exponential family models have been fixed.
gof
now automatically selects the
right goodness-of-fit statistics for the network type (directed
vs. undirected) given.
Bug in is.inCH in 2.4-2 fixed in 2.4-3.
as.directed
function has been removed.
All model terms included in the package have been
reimplemented using the new InitErgmTerm
framework.