Questions tagged [plm]

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

510 questions
2
votes
1 answer

R Extract Log Likelihood from a plm object

I would like to extract the log likelihood from a plm object. It works fine when using the logLik function from the base stats package with either felm from the lfe package or feols from the fixest package, but not with any plm object where the…
Moritz Schwarz
  • 2,019
  • 2
  • 15
  • 33
2
votes
1 answer

plm function and heteroscedasticity-robust standard errors

I am using the plm function (from package plm) using fixed effects. I need to guarantee that I am using heteroscedasticity-robust standard errors while using the function plm. lag1.1 <- plm(E.primary ~ lv18_bank_c + Expense + lag(Expense, 1),…
2
votes
1 answer

How to index predict plm object in R

Using the predict() function on plm object gives insample predicted values for each entity in a fixed effects model. How does one index the resultant double object to obtain the predicted values for just one entity? Example…
Justin
  • 327
  • 1
  • 3
  • 11
2
votes
0 answers

Robust Standard Errors with plm automatically computed?

Today I ran a fixed effects model in plm using unbalanced panel data with N>>T (N=5970 and T=10). Unfortunately the data is from a database that does not allow me to share it. However, my equation is the following: pl <-…
roewizz
  • 21
  • 2
2
votes
1 answer

duplicate couples (id-time) error in plm with only two IDs

I'm trying to run a fixed effects regression using the plm package. The regression code is as following: fixed = plm(hp~crime,index=c('year','country'),data=data,model='within') which returns the following error code: error in…
Jens
  • 125
  • 1
  • 7
2
votes
2 answers

model with three fixed effects in plm package in R

I am trying to estimate the model with 3 fixed effects. One is a customer-fixed effect, another one is good fixed effect and the third one is time-fixed effect. I am new to plm package, but as I understand, if I had just 2 fixed effects (time and…
2
votes
3 answers

2-way FE model gives "empty model" in R

I am trying to run a 2-way fixed effect model in R, using plm. I am trying to get the treatment effect of an event on municipalities votes on referenda. I would like to run the model with municipality and referenda fixed effects. Each row or unit is…
AntVal
  • 583
  • 3
  • 18
2
votes
1 answer

R, add back fitted values plm(), the fitted values are fewer than the observations in the regression

We're doing a panel regression using the plm() function of R package plm and want add the fitted values as a new column to the dataset on which the regression was made. MP_regression <- plm(operating_exp ~ HHI + rate + rate_lag1 + rate_lag2 + …
Karl Wig
  • 55
  • 4
2
votes
1 answer

Error in is.pbalanced.default(x) : argument "y" is missing, with no default, due to stata imported labels

For the following panel data set: panel <- structure(list(uurwerk = structure(c(40, 40, 40, 40, 36, 1, 32, 36, 32, 32, 36, 36, 40, 40, 40, 40, 40, 38, 38, 38, 38, 60, 55, 40, 42, 42, 42), label = "hours/week work in fact (on average)", class =…
Tom
  • 2,173
  • 1
  • 17
  • 44
2
votes
0 answers

How to Perform Panel Unit Root Test Using cipstest Function of plm Package and Panel Cointegration Test Using pedroni99m Function of pco Package

I'm trying to calculate two tests on my panel data. However, following the documentations for the various packages and respective functions, I obtain errors. My search online for possible remedies has not being fruitful. First, I want to perform a…
Azaaviela
  • 71
  • 6
2
votes
1 answer

Regression confidence bands from plm models

I am currently running a fixed effects model with the use of the plm function from the package of the same name. I have clustering in the data, so I am using the vcovCR function from the clubSandwich package to get the standard errors of the…
Phil
  • 595
  • 1
  • 5
  • 15
2
votes
1 answer

R: Filtering data in plm

I have a pdata.frame for 14 years x 89 observations and 10 variables + 4 dummies. Those dummies variables are only for filtering (when necessary) my data. When using Stata, I just add an "if VAR==1" at the end of my code. How to use this with plm…
Adilson V Casula
  • 164
  • 1
  • 16
2
votes
1 answer

How to include number of groups from a panel regression (plm) in stargazer tables

Regression result tables are produced via stargazer from plm objects. Below in the summary part, only Oberservations, R², Adjusted R² and the F Statistic are presented. I would also like to include the number of groups and periods. These appear as…
Dima
  • 146
  • 1
  • 1
  • 12
2
votes
0 answers

Second generation panel unit root test: CIPS TEST

I was trying to conduct a panel unit root test of Pesaran 2007, in the plm package, using cipstest() function. CIPS stands for Crossectionally -augmented IPS(2003) test due to << Im K, Pesaran H, Shin Y. 2003. Testing for unit roots in heterogeneous…
Eyayaw
  • 1,033
  • 5
  • 10
2
votes
0 answers

R: Extend plm() and coeftest() output printed via texreg()

Consider the following simplistic example of fixed effects regressions: # Load packages packs <- list("texreg", "plm", "lmtest") lapply(packs, require, character.only = T) # Load mtcars data set d <- mtcars # Run fixed effects…
Chr
  • 1,017
  • 1
  • 8
  • 29