leifeld / btergm

Temporal Exponential Random Graph Models by Bootstrapped Pseudolikelihood
16 stars 10 forks source link

A new temporal dependency term #27

Closed rwss2021 closed 2 years ago

rwss2021 commented 3 years ago

Hi there! I think your work could be very useful to my current research. And I have a general question on creating temporal dependencies. If I want to use the attached dependency, do I need to create a customized one by myself? If so, could u please provide some suggestions on reading your codes?

Popularity

Thank you for your time!

leifeld commented 3 years ago

Hi there. Dyadic temporal statistics like delayed reciprocity, memory terms etc., and also the term above, have the advantage that at time t the previous networks at t-1 and before are already known and functions of it can be employed simply as dyadic covariates. To do what you are describing, I would create a list of change statistic matrices and simply add it to the model using an edgecov term. Make sure the row and column names of the matrices in the list reference the nodes properly, then the package will automatically take care of any node composition change. Figuring out these change statistics can be tricky, but you could take a look at my JSS paper for some examples on delayed reciprocity and memory terms for guidance.

The package does not currently permit writing your own extensions in a comfortable way. In fact, the current temporal statistics are hardcoded in a somewhat crude way by parsing the model formula using regular expressions. See here and here (and the following lines there) for examples. You will probably not want to do this, but if you decide to hardcode any statistics, please feel free to open a pull request.

The above solution assumes that it does not matter what any dyad other than (kj) does at time t, i.e., the dyads are conditionally independent given the other model terms and the past networks, which have already happened. If you think that (ij) must still exist at t or that (ik) and (ki) must still be absent at t for your statistic to work, then you would need a dyad dependence term. Unfortunately, the way the package was written does not currently permit implementing such temporal endogenous network statistics that involve multiple dyads at t as well as past network dyads. So it depends on the assumptions you are willing to make...

rwss2021 commented 3 years ago

Thanks a lot!!