'Is there any R package for producing marginal effects plots from interaction terms in spatial models? (Using spdep::lagsarlm)
There are several easy and efficient R packages and functions to produce conditional effects plots (marginal effects) for linear regression models, such as interplot (Solt and Hu 2021), ggeffects (Lüdecke 2018), and JKmisc/ggintfun.R (Karreth 2017). However, I could not find any package or function to produce marginal effects graphs for spatial models. In particular, I am conducting a SAR model using the command lagsarlm from the package spdep.
Consider, for example, the SAR model specification below:
Y = B1X1 + B2X2 + B3X3 + B4X1X2 + B5X3X2 + pWy
In this example, I would like to produce two marginal effects plots according to the interaction terms:
- The conditional effect of X1 on Y when X2 is increasing.
- The conditional effect of X3 on Y when X2 is increasing.
Is there any way to produce these graphs in R from the results generated using the command lagsarlm (package spdep)?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
