11.11 Packages & Functions: plm

  • AER and plm package
  • plm(): Estimate linear models for panel data using lm() on transformed data
    • index =: Specify the index variables (unit’s id and e.g. time)
    • model =: one of "pooling", "within", "between", "random", "fd", or "ht"
      • "pooling" = pooled OLS
      • "within" = fixed effects
      • "fd" = first-differences
      • "random" = random effects (?)
      • "between" = between (?)
    • See Croissant and Millo (2008) for an overview of the package.
  • Important, sometimes there are conflicts between packages (e.g., plm and dplyr)
    • e.g., between dplyr::lag and stats::lag
    • It might be necessary to specify which functions plm should rely on by using the conflicted packages
      • library(conflicted), conflict_prefer("filter", "stats"), conflict_prefer("lag", "stats")

References

Croissant, Yves, and Giovanni Millo. 2008. “Panel Data Econometrics in R: The Plm Package.” Journal of Statistical Software, Articles 27 (2): 1–43.