# R: difference in interpreting estimates of plm and LSDV model?

What is the difference in the estimates of plm and least squares dummy variable (LSDV) models? And how does the interpretation of the variables differ in general?

Imagine the following plm() and lm() + factor():

within <- plm(dependent_var ~ independent_var, data = dataset, method = "within" , effect = "twoways")

LSDV <- lm(dependent_var ~ independent_var + factor(individual) - 1 + factor(time), data = dataset)


The "within estimator" and the least squares dummy variable (LSDV) estimator yield equivalent estimates of independent_var. Including a full series of indicator variables for the panel and/or temporal identifier is algebraically equivalent to estimation in deviations from means. Though the mechanics may differ, it should not affect your interpretation of independent_var.

Suggestions:

It isn't necessary to drop the intercept inside of the lm() function, though it shouldn't affect your point estimates.

Also, don't forget to set your indexes when using plm() to estimate a panel model. Either coerce your data frame using pdata.frame():

panel_dataset <- pdata.frame(dataset, index = c("individual", "time"))


or, simply set the panel indexes inside of your call to plm() after the model formula. The latter approach saves you some extra keystrokes:

plm(y ~ x, data = dataset, index = c("individual", "time"), method = "within", effect = "twoways")

• Thank you @thomas bilach!! Mar 17, 2021 at 0:21
• Also, don't forget to set your indexes. I'm sure you've already pre-processed the data frame, but I couldn't be sure. I updated my answer with some suggestions. Mar 17, 2021 at 0:42