Hi everyone

From this discussion, Daniel Klein wrote a program called "bogus" that is able to correctly apply -margins- on an interaction term calculated manually.

In that example, the interaction term was created from 2 continuous variables. I am trying to modify the "bogus" program for interaction terms created from 2 or more binary variables.

As such, can I please ask someone to explain in a bit more detail what each line is doing in that program? And if its modification to accomodate interaction term from binary variable is a relatively straightforward process?

Thanks,
Junran