Questions tagged [plm]

The `plm` package for R provides functions for linear models for panel data.

The plm package for R provides functions for linear models for panel data.

The package cover statistical concepts such as

  • Statistical tests for pannel data (e.g. for serial correlation)
  • General methods of moments (GMM) for pannel data
  • Random effects (RE)
  • Fixed Effects (FE)
  • First Difference (FD)

Tutorials:

122 questions
61
votes
5 answers

How exactly does a "random effects model" in econometrics relate to mixed models outside of econometrics?

I used to think that "random effects model" in econometrics corresponds to a "mixed model with random intercept" outside of econometrics, but now I am not sure. Does it? Econometrics uses terms like "fixed effects" and "random effects" somewhat…
amoeba
  • 93,463
  • 28
  • 275
  • 317
10
votes
1 answer

comparing groups in repeated measures FE models, with a nested error component, estimated using plm

I have estimated some repeated measures Fixed Effects models, with a nested error component, based on on grouping variables, i.e. non-nested models, using plm. I am now interested to test if the full models are significantly different, i.e. $$H_o:…
Eric Fail
  • 439
  • 1
  • 5
  • 18
8
votes
2 answers

Effects in panel models "individual", "time" or "twoways"

Panel estimators such the one implemented in the R package plm allow to estimate "individual", "time" or "twoways" effects. See page 11. When do I use which of the three possible specifications?
majom
  • 872
  • 1
  • 12
  • 27
7
votes
1 answer

Three way fixed effects vs combining two of the effects

I have panel data on employment that varies by year, sector and location and thus would like to run a fixed effects regression considering these 3 dimensions. The issue is that I use R and the plm package and it only allows me to have two fixed…
6
votes
2 answers

Why does a fixed-effect OLS need unique time elements?

The plm function of the plm library in R is giving me grief over having duplicate time-id couples, even when I'm running a model that I don't think should need a time variable at all (see reproducible example below). I can think of three…
Ari B. Friedman
  • 3,421
  • 4
  • 33
  • 42
6
votes
1 answer

Difference between fixed effects models in R (plm) and Stata (xtreg)

I'm trying to re-create an analysis done using Stata function xtreg (though I don't have the code) with R package plm, and I'm having trouble translating between the two. A minimal example of the model I'm trying to estimate would be as…
gwatson
  • 171
  • 1
  • 1
  • 5
6
votes
1 answer

Estimating robust standard errors in panel data regressions

I am trying to estimate robust standard errors in a panel data regression. I understand panel data regressions conceptually, but R offers a lot of options I am not sure about. My data is of the following format: id time name y …
EDC
  • 378
  • 1
  • 3
  • 7
5
votes
1 answer

Random Effects Results in R (plm) Cannot Replicate Results in Stata

I have been working on migrating a current project from Stata to R, where I have encountered difficulties with differing results of random effects regressions. I have panel data from an experiment where the treatment dummy is perfectly correlated…
Juri
  • 53
  • 5
5
votes
1 answer

Within model with plm package

I have a question about plm package. My code is: fixedmodel <- plm(formula=Inv_ret~Firm.size+leverage+Risk+Liquidity+Equity, data=datanewp, model="within") In the plm vignette the authors write: This is called the fixed effects…
user1665355
  • 480
  • 7
  • 15
5
votes
1 answer

Hand computation for plm package in R for predicted values

I am trying to fully understand the ins and outs of the plm package in R. I have a dataset where I computed a fixed effects plm: mydata <- read.spss("G:/data.sav",use.value.labels=TRUE, to.data.frame = TRUE) attach(mydata) Y <- cbind(Y) X <-…
CooperBuckeye05
  • 423
  • 1
  • 6
  • 16
4
votes
1 answer

Is it ok to run a plm fixed effect model and add a factor dummy variable in R?

Is it ok to run a "plm" fixed effect model and add a factor dummy variable in R as below? The three factors "Time", "Firm” and "Country" are all separate indices which I want to fix all together. Instead of making two indices in total by combining…
Eric
  • 434
  • 1
  • 10
  • 27
4
votes
2 answers

plm in fixed effects model doesn't work with id and time

I am writing currently my thesis and I am stuck with a problem. I am trying to figure out how firm level, country level and industry level variables influence corporate social responsibility. I want to add Industry (SEC) and time fixed effects. But…
Julia Pfaller
  • 41
  • 1
  • 4
4
votes
0 answers

Fitting panel data with both variable and constant coefficients using R

I'm working with panel data and want to fit a model of the form: $y_{ij} = \alpha_{i} + \beta_{1i} x_{1ij} + \beta_{2i} x_{2ij} + \beta_{3} treatment_{ij} + \epsilon_{ij}$ The data consist of (unbalanced) time series for a number of individuals,…
gub
  • 41
  • 3
4
votes
0 answers

How to properly use generalized method of moments (GMM) estimation with plm in R?

In the context of panel data analysis my key independent variable wage affects the response not immediately but rather over time. Therefore I would like to use some lagged values of wage $X_{it-1}$, $X_{it-2}$, $X_{it-3}$ ... I read that in order to…
Mamba
  • 295
  • 3
  • 12
4
votes
1 answer

Computing the predicted value from a panel data model with the plm R package

I am estimating the following panel data twoways fixed effect model: y = alfa*y.lag + beta1*z + beta2*z^2 + theta*id + gamma*t (1) where id is the individual effect, t is the time effect. I am using the {plm} package in r, therefore the code…
Bob
  • 251
  • 1
  • 3
  • 10
1
2 3
8 9