I have many panels of two-year longitudinal data, something of the form:
# A tibble: 8 x 5
ID year Y X1 X2
<int> <int> <int> <int> <fctr>
1 1 2015 2 2 D
2 1 2016 4 5 C
3 2 2015 1 5 A
4 2 2016 1 2 C
5 3 2015 4 3 D
6 3 2016 5 3 B
7 4 2015 3 1 C
8 4 2016 3 1 C
I am interested in how changes in $X_1$ and $X_2$ affect changes in $Y$. My data has many different types of variables, and in this instance $X_1$ is ordinal and $X_2$ is nominal.
I am particularly interested in how a transition from $A$ to $B$ or vice versa in the variable $X_2$ would affect $Y$.
Initially I was thinking of modelling the change in $Y$ is a linear regression with dummy variables for where $X_2$ goes from $A$ to $B$ or vice versa, and also including $X_1$.
Doing a quick google search leads me to a lot of literature relating to these sorts of problems, however, I have never worked with panel data before, and I am in need of a good starting point, ideally with examples, and perhaps implementation which is available in R.
Previous authors working with a similar dataset have done this using pooled OLS, though, I am not well versed in this area and have read commentary about fixed effects and random effects modelling which is preferable to pooled OLS.
Any suggestions or guidance would be greatly appreciated.
plm
(cran.rstudio.com/web/packages/plm). See the vignette for an introduction. Also, Wooldridge, Introductory Econometrics, is a good starting point. Here is a book which builds on top of Wooldridge and gives R implementations: urfie.net/index.html $\endgroup$