I'm using the plm() package to run a fixed effects regression model for repeated observations during 5 years. I am testing the impact of being eligible to a social transfer program on hours worked. However, I have a suspicion that few of the people in my sample move from being eligible to not eligible over these 5 years. I would like to know how many of them have moved from 0 to 1 since my variable is a dummy one. The expected outcome is like this :
Like Stata's command xttrans. For instance here, each year, some 80% of the msp 0 persons in the data remained msp 0 in the next year; the remaining 20% became msp 1.
Does anyone have a solution in R? Thank you so much!
To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:
You can share your data in a forum friendly way by passing the data to share to the dput() function.
If your data is too large you can use standard methods to reduce it before sending to dput().
When you come to share the dput() text that represents your data, please be sure to format your post with triple backticks on the line before your code begins to format it appropriately.