Questions tagged [plm]

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

510 questions
1
vote
0 answers

How to deal with error of purtest on panel data

I'm currently working with panel data and need to perform a stationarity test. Using The package plm I ran into the following error message: Error in urca::punitroot(x, N = Inf, trend = punitroot.exo) : NAs are not allowed when na.rm=FALSE I…
user12575032
  • 77
  • 1
  • 6
1
vote
1 answer

Fixed Effects plm error: Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases

I'm attempting to run a fixed effects estimator on my data, and even though the pooling, between, and first differences estimators all worked, I keep getting this error when attempting the fixed effects estimator: Error in class(x) <-…
1
vote
1 answer

plm - industry + year fixed effects with firm-year data

My question is, how do I include industry and year fixed effects in plm, when I have multiple firms in same industry in same year? Repex of my data looks like this: Year Industry CompanyID CEOID CEO.background MBA.CEO CEO.Tenure …
PSL
  • 11
  • 2
1
vote
1 answer

how are the Degrees of freedom calculated in plm:::vcovDC.plm?

I use a fixed effect model with time and group fixed effects. Further, I want to calculate robust clustered standard errors. Therefore, I use coeftest(model, vcov = vcovDC(model)) I do not understand how the degrees of freedom are calculated for…
dpendi
  • 329
  • 2
  • 9
1
vote
1 answer

How to fix 'duplicate row.names' in plm package?

I'm a beginner with R, so bear with me. I've spent a while trying to fix this issue based on earlier answers, but I can't work it out. I want to run a panel regression using the plm package. However, when I try code of the form reg<-plm(y ~ x1, x2,…
Maurits W.
  • 13
  • 3
1
vote
1 answer

Error when estimating random effects model with plm package when haven is loaded

I have a weird problem when estimating a random effects with the plm package in R. Here is a link to a dput of part of my data: https://pastebin.com/raw/mTdh26dg My code is: library(plm) library(haven) pmales <- pdata.frame(males_part, index =…
avs
  • 617
  • 5
  • 13
1
vote
0 answers

why is make.pbalanced from plm so slow on medium-sized datasets?

Here's an example that shows that the function make.pbalanced from plm is much slower than a manual solution using a couple lines of dplyr. I create a panel data set of 20,000 units over 20 years, and randomly drop 10% of rows. I then rebalance it…
sam
  • 67
  • 7
1
vote
0 answers

Error in approx(nintv, cvals[nintl:ninth, tintl, i], n = max(nintv) - : need at least two non-NA values to interpolate

I am trying to apply the second generation panel unit root tests (CIPS test) using function cipstest() of package plm in R. I am getting this error: Error in approx(nintv, cvals[nintl:ninth, tintl, i], n = max(nintv) - : need at least two non-NA…
Ozge
  • 31
  • 1
1
vote
1 answer

Is there a way to specify values in a plm function?

I'm currently working on a project for which I need to differ my main explanatory variable. I'm building an individual fixed effects model with plm and need to "cut in half" a variable. Unfortunately I can't provide a repex but a part of the code.…
1
vote
0 answers

Error pgmm function: number of rows of matrices must match

As part of my research dissertation, I have to perform regressions, however, after performing tests, my model is not homeostatic, and it is possible that there are problems of endogeneity. So I wanted to test the pggm function by performing the…
clémence
  • 11
  • 2
1
vote
0 answers

fixed effect regression cannot recognize Chinese characters as individual fixed effect

I am running a poisson regression with fixed effect. My individual fixed effects are city names in Chinese characters. However, pglm cannot recognize them. Below is my data set. Column city represents cities in this panel data, whereas time…
Yabin Da
  • 553
  • 5
  • 11
1
vote
0 answers

plm() versus lm() with multiple fixed effects

I am attempting to run a model with county, year, and state:year fixed effects. The lm() approach looks like this: lm <- lm(data = mydata, formula = y ~ x + county + year + state:year where county, year, and state:year are all factors. Because I…
liv96
  • 31
  • 2
1
vote
1 answer

R code to test the difference between coefficients of regressors from one panel regression

I am trying to compare two regression coefficient from the same panel regression used over two different time periods in order to confirm the statistical significance of difference. Therefore, running my panel regression first with observations over…
B-Z
  • 83
  • 7
1
vote
0 answers

GLS regression on Panel Data and group clustering in R

I have a panel data set with 216 individuals that took part in a game of 10 rounds, so I have 2160 observations. The participants were asked to make contributions: C_it is the contribution of all i to t. All the participants were part of a group, 18…
muntui08
  • 11
  • 1
1
vote
2 answers

Trying to reproduce xtreg in stata with plm in R

I can't seem to match the xtreg command in Stata in R without using the fe option in Stata. The coefficients are the same in Stata and R when I do a standard regression or a panel model with fixed effects. Sample data: library("plm" ) z <- Cigar[…
MatthewR
  • 2,660
  • 5
  • 26
  • 37