Questions tagged [plm]

R package primarily concerned with panel data. Package contains a set of estimators and tests for panel data.

510 questions
3
votes
0 answers

In plm, unexpected difference between model = "within" on pre-differenced variable and model = "fd"?

I am fitting a diff-in-diff model on panel data with multiple treatment windows using the plm package. In the plm package, there are options to set: - model = "within" vs model = "fd" (first difference). Why dont the following produce equivalent…
3
votes
0 answers

Error in 1 - diaghat : non-numeric argument to binary operator

I wanto to run a two way fixed effects model and then correct standard errors. mod3 = plm(Dir ~ Dist +Trade + GDP_sim +GDP + GDP_capita_constant +Openess + GDP_g + Endowments + US_PTA + Japan_PTA + FDI + Population+…
Julian
  • 31
  • 1
3
votes
1 answer

estimate a repeated measures random effects model with a nested structure using `plm()`

Is it possible to estimate a repeated measures random effects model with a nested structure using plm() from the plm package? I know it is possible with lmer() from the lme4 package. However, lmer() rely on a likelihood framework and I am curious to…
Eric Fail
  • 8,191
  • 8
  • 72
  • 128
3
votes
1 answer

degrees of freedom panel data fixed effects (plm)

I don't understand how R calculates the degrees of freedom in the case of panel data and fixed effects. I particular I have 2 doubts: 1) When fitting a Least Squares Dummy Variable model using the two alternative strategies of: a) including N…
3
votes
4 answers

How to run regressions on multidimensional panel data in R

I need to run a regression on a panel data . It has 3 dimensions (Year * Company * Country). For example: ============================================ year | comp | count | value.x | value.y ------+------+-------+----------+----------- 2000 | …
para19bellum
  • 55
  • 2
  • 8
3
votes
2 answers

How to calculate BIC and AIC for a gmm model in R using plm?

I'm estimating a GMM model using the plm library. I have different moment conditions. Z <- list(~YDWPP + ST_DEGREE, ~YDWPP + ST_DEGREE, ~YDWPP + ST_DEGREE, ~YDWPP + ST_DEGREE, ~YDWPP + ST_TRANSITIVITY, ~YDWPP + ST_STRUC_HOLE, ~YDWPP +…
Mario GS
  • 859
  • 8
  • 22
3
votes
1 answer

R plm lag - what is the equivalent to L1.x in Stata?

Using the plm package in R to fit a fixed-effects model, what is the correct syntax to add a lagged variable to the model? Similar to the 'L1.variable' command in Stata. Here is my attempt adding a lagged variable (this is a test model and it might…
M_M
  • 899
  • 8
  • 21
3
votes
5 answers

R Stargazer with pglm model - convert binominal pglm model in plm model

I am using stargazer to create my plm summary tables. library(plm) library(pglm) data("Unions", package = "pglm") anb1 <- plm(wage ~ union + exper + rural, Unions, model = "random", method = "bfgs") stargazer(anb1) Unfortunately stargazer does not…
Nils
  • 129
  • 1
  • 9
3
votes
3 answers

How to deal with Error: 0 (non-NA) cases plm package?

I know this has been asked, and I've looked at at least 10 threads on this topic, but I still can't understand it. I'm using the plm package to estimate a random effects model on some panel data. I have a model that I have specified, but when I…
Xander
  • 87
  • 1
  • 11
3
votes
1 answer

R plm thinks my number vector is a factor, why?

With this data input: A B C D 0.0513748973337 0.442624990365 0.044669941640565 12023787.0495 -0.047511808790502 0.199057057555 0.067542653775225 6674747.75598 0.250333519823608 0.0400359422093 -0.062361320324768 …
Mikk
  • 804
  • 8
  • 23
3
votes
1 answer

Regression using plm package and twoways effect, when data has NA

So, I'd like to run a regression on a panel data, using two-ways effects, for time and stores. If the panel is perfectly balanced, it works fine, but for some reason, if it's not, the code gets stuck. (see:…
thiagogps
  • 439
  • 4
  • 12
3
votes
1 answer

fixed effects in R: plm vs lm + factor()

I'm trying to run a fixed effects regression model in R. I want to control for heterogeneity in variables C and D (neither are a time variable). I tried the following two approaches: 1) Use the plm package: Gives me the following error…
dleal
  • 2,244
  • 6
  • 27
  • 49
3
votes
1 answer

computing F statistic with user supplied covariance matrix

see edits below With package plm, I was wondering why the F statistic displayed by summary() does not change once I supply a covariance matrix (for robust standard errors). Consider the following code, I do not get a change in the F statistic as…
Helix123
  • 3,502
  • 2
  • 16
  • 36
3
votes
1 answer

Prediction with plm method

I'm using plm package to estimate a random effects model on panel data. Reading this question about the prediction in plm package gives me some doubts. How exactly it works? I tried 3 alternatives methods and they give different solutions. Why…
dax90
  • 1,088
  • 14
  • 29
3
votes
1 answer

Use all variables in a model with {plm} in R

Using different sources, I wrote a little function that creates a table with standard errors, t statistics and standard errors that are clustered according to a group variable "cluster" after a linear regression model. The code is as follows cl1 <-…
Doon_Bogan
  • 359
  • 5
  • 17