Learn R Programming

tergm (version 4.2.1)

.extract.fd.formulae: An Internal Function for Extracting (Some) Formation and Dissolution Formulas from a Combined Formula

Description

This function is used in tergm.EGMME.initialfit and also when targets or monitoring formulas are specified by characters. It makes a basic attempt to identify the formation and dissolution formulas within a larger combined formula (which may also include non-separable terms). Instances of Form at the top level (which may occur inside offset) contribute to the formation formula; instances of Persist and Diss at the top level (which may also occur inside offset) contribute to the dissolution formula. All other terms are regarded as non-separable; this includes instances of Form, Persist, and Diss that occur inside other operator terms, including inside Offset, and also includes all interactions at the top level (for which the top level term is effectively the interaction operator * or :), whether or not they include Form, Persist, and/or Diss. The formation and dissolution formulas are obtained by adding the contributing terms, replacing Form and Persist with trivial operators that protect the environments of their formula arguments but have no effect on statistics or coefficient names (meaning the formulas effectively become cross-sectional), and replacing Diss by a similar operator that negates statistics. These are included in the return value as the form and pers elements of the list (the "dissolution" formula really being the persistence formula), which also includes the formula of non-separable terms as nonsep, and the formula of all terms after replacing Form, Persist, and Diss as described above as all.

If usage proves problematic, one may specify the monitoring and/or targets formulas explicitly (rather than by characters), and one may pass initial coefficient values for the EGMME to avoid running tergm.EGMME.initialfit.

Usage

.extract.fd.formulae(formula)

Value

A list containing form, pers, nonsep, and all formulas as described above.

Arguments

formula

a formula.