Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use concatenation of ergm_model and ergm_conlist objects instead of formula alchemy whenever possible. #475

Open
krivit opened this issue Jul 17, 2022 · 0 comments

Comments

@krivit
Copy link
Member

krivit commented Jul 17, 2022

Formulas come with an environment in which their terms should be evaluated, e.g., ~nodefactor(x), where x is a variable present in the formula's environment. If the environment changes, the formula may no longer evaluate as intended.

When combining two formulas, there is no unique way to combine their environments, unless one of them is trivial (e.g., baseenv or globalenv) or known to be unused (e.g., known to contain specific terms . statnet.common::nonsimp_update.formula() offers a number of options, but every option has the possibility of breaking something.

Thus, we should, in general, avoid concatenating formulas. Currently, the "unsafe" concatenations are done in .handle.auto.constraints() and, to an extent, ergm(), though the latter is only a problem if the RHS of the formula references TARGET_STATS. In principle, it should be able to rename it to something else that's not a regularly used variable name.

Auto constraints is a bit more complicated, since the API makes use of dot-substitution of the %ergmlhs% constraints into the constraints= constraints. We might therefore need some method for passing multiple formulas that are processed into constraint lists and then dot-substituted.

krivit added a commit to statnet/statnet.common that referenced this issue Jul 18, 2022
…at stores the source environment, signs and supports concatenation and indexing.

referneces statnet/ergm#475
krivit added a commit to statnet/statnet.common that referenced this issue Jul 18, 2022
krivit added a commit that referenced this issue Jul 18, 2022
krivit added a commit that referenced this issue Jul 23, 2022
krivit added a commit that referenced this issue Jul 23, 2022
krivit added a commit that referenced this issue Jul 23, 2022
krivit added a commit that referenced this issue Jul 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant