[R] Manage unbalanced panel with plm

laura roncaglia roncaglia.laura at gmail.com
Thu Nov 3 10:05:41 CET 2016


Dear all,

I am using an unbalanced panel dataframe to run my analysis. The df is
based on a national survey and I know the reason why the df is unbalanced.

I tried to understand if plm package corrects for unbalanced panel, so that
I can use the plm package without problem.

I create a plm.data using the following code:

dd.p <- plm.data("id", "year")

and then run fixed effect regression, like this one:

fe1 <- plm(pens ~ woman + age + sqage + high + medium, model="within",
effect="individual", data=dd.p)

So is my approach correct? Does the plm actually correct for unbalanced
panel?

Instead if I need to balance the panel I'd use this code:

dd <- dd %>%
group_by(id) %>%
fileter(n()>2)

(the df is from 2010 to 2013, filtering only id present more than 2 times
would mean that I take only people present three times)

Thanks in advance

	[[alternative HTML version deleted]]



More information about the R-help mailing list