statnet / ergm.terms.contrib

Community-contributed ERGM model terms
5 stars 3 forks source link

Bipartite homophily terms contributed by Aurelius Noble #12

Open krivit opened 4 years ago

krivit commented 4 years ago

We need to figure out whether this should go into this package or into the main ergm, and what fixes are needed.

The source is in ergm.userterms_3.10.0.tar.gz.

I am reproducing Aurelius's e-mail here with permission:

I just wanted to let you know that I had finished an early, but functional version of the package extension. It adds in a new term, b2gwtwostar. This basically does the same thing as the b1nodematch term, except you can specify node-pairs with specific attribute-level pairings. For instance, “blue.red” instead of the “blue.blue” pairing that b1nodematch would give for the level “blue”. Currently levels are specified as “level1.level2”. If you would prefer the levels to be specified in a different way please let me know (I still need to fix the NULL levels specification). It takes the arguments (b1attr,levels,alpha,beta). I left the package name as the default ergm.userterms.

As far as I can tell this term functions as it should, and hopefully it should address some of the degeneracy issues typical with these two-star terms. When beta/alpha is set to 1 it should be identical to b2twostar and when beta/alpha is less than 1 it should be identical to b1nodematch regarding the homophilous terms. I’ve used the summary and ergm functions with a set seeds to test this and it seems to match up.

Testing it on randomly generated networks, it seems to work fine. However, it seems to have significant difficult converging when using a beta decay parameter < 1 for terms which are non-homophilous pairs. I’m not sure why it is having difficult converging when using a beta decay parameter on non-homophilous pairs. The entire point of this parameter is to make the term more stable. The alpha decay parameter seems to aid convergence issues in the random networks; but not perform particularly well in real-world networks.

I would really appreciate it if you could take a look at the term some time, and tell me whether there is anything obviously wrong with it. Also, if you had any thoughts on why the beta decay parameter functions poorly for non-homophilous terms/how to address this, that would be greatly appreciated. I think it is probably related to collinearity with b1cov or b1factor terms.

martinamorris commented 4 years ago

i'd vote to leave in contrib.