EpiModel/EpiModelHIV

absdiffby summary statistic

DamienGeorges opened this issue · 3 comments

Hi Sam, Hi all,

I want to use absdiffby than I need to compute the target.

I can't find any fully explicit help file of absdiffby term. (here is the actual help file right? https://github.com/statnet/EpiModelHIV/blob/master/R/ErgmTerms.R )

Could you please tell me what this summary stat is exactly?

Which is the ref category? (e.g. by arg is sex and coded 0/1)
What the arg assym stands for?
Is the term code is https://github.com/statnet/EpiModelHIV/blob/master/src/changestats.users.c ?

Thanks,
Damien

Hi Damien,

Sam is offline for a bit, so I'll try to pinch hit here.

The code for user written ergm terms (like this one) has two pieces, one is the R code you note above, the other is the C code that actually does the calculation, here:

https://github.com/statnet/EpiModelHIV/blob/master/src/changestats.users.c

I'm not a C coder, but this is a pretty simple term. Its primary purpose is to modify the vanilla absdiff term to allow for an "asymmetry" in the age differences by a binary variable like sex: males are typically older than their female partners, and you can take the average difference in age as an "offset" to recenter the age difference to 0 at that value. Net of this offset, the difference in ages then works as before.

As the code shows, when the by variable=1, the contribution to the term is

INPUT_PARAM[t] - INPUT_PARAM[h] - offset

and when =0

INPUT_PARAM[t] - INPUT_PARAM[h] + offset

So, when by=sex, and E(age(M)-age(F)) > 0, M should be coded 1, and F should be coded 0.

LMK if this makes sense.

@sgoodreau pls add comments or corrections as needed :)

Excellent!
Thanks a lot!
That makes lot of sense and adding this term to my network make the model outputs much more realistic!
Thanks one more time for the kind and fast assistance.
Damien