Skip to content

Commit

Permalink
Fix SLX impacts (closes r-spatial#23) by scaling lm coefs
Browse files Browse the repository at this point in the history
As documented in issue r-spatial#23 and doi.org/10.13140/RG.2.2.11269.68328
the average indirect effects of the SLX model are not correct for
non-row-stochastic matrices. This commit fixes that.

To be maximally non-invasive to users, I apply the necessary scale
factor to the coefficients of the underlying LM model. This means
that the coefficients *can* be directly interpreted as partial
effects -- which is probably the way it's being done anyways.

This could also be addressed in a more involved manner (for users
and coders) -- we could apply the scale factor only to the indirect
impacts (returned by 'impacts()') and only adjust the model used to
compute total effects. I did not pursue this as it (1) would require
more code, (2) be more contrived, and (3) does not reflect usage
patterns that I would expect.
  • Loading branch information
Nikolas Kuschnig committed Dec 17, 2021
1 parent ae65861 commit a9b9874
Showing 1 changed file with 174 additions and 185 deletions.
Loading

1 comment on commit a9b9874

@rsbivand
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the code was re-formatted, I have no idea what the real diff is. I can't accept things I can't read,

Please sign in to comment.