tfr
tfr

Reputation: 71

How to visualize an interaction term of a panel model in r?

I aim to visualize an interaction term of a fixed effect model. I tried the packages 'visreg' and 'ggplot2', but it seems not possible.

How can I do that?

Thanks in advance.

Example dataset and panel model:

library(plm)
data(EmplUK)

m1 <- plm(emp ~ wage + capital + lag(output,1) + capital:lag(output,1), 
          data = EmplUK, model="within", effect="twoway", index=c("firm","year"))

Upvotes: 1

Views: 2185

Answers (2)

Daniel
Daniel

Reputation: 7832

In the current CRAN-version of sjPlot, the sjp.int function does not support plm objects.

However, I`ve implemented it in the current GitHub-version.

Taking your example from above, the following code:

sjp.int(m1)

produces following plot:

enter image description here

I'm not sure whether all kind of designs / models fitted with plm do work with sjp.int, if you find any bugs, feel free to file an issue (at GitHub).

Upvotes: 1

Helix123
Helix123

Reputation: 3677

Maybe the package here comes in handy? http://www.strengejacke.de/sjPlot/sjp.int/

Also the probemod package from CRAN could help.

Upvotes: 0

Related Questions