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
1 answer

Is there a way to both include PCSE and Prais-Winsten correction in a fixed effects model in R (similar to the xtpcse function in Stata)?

I want to estimate a fixed effects model while using panel-corrected standard errors as well as Prais-Winsten (AR1) transformation in order to solve panel heteroscedasticity, contemporaneous spatial correlation and autocorrelation. I have…
1
vote
1 answer

Data frame consisting of characters is converted to factors after pdata.frame command in R. How to make pooled OLS work?

I am using a panel data set: y is my independent variable equal to 0 or 1 --> numeric x1 are my individuals --> numeric x2 are my time indicators --> numeric x3,x4,...,x65 are my independent variables --> character In the code below I convert all…
1
vote
1 answer

How do I perform a joint Wald test on panel data regression coefficients against some specific values?

I would like to do a simple joint Wald test on my fixed-effects regression coefficients but I want to set the restriction to something other than zero. More specifically I would like to test: H0: ai=0 and b=1 for every i or basically, whether the…
Erwin Rhine
  • 303
  • 2
  • 11
1
vote
2 answers

Error in class(x) while creating panel data using plm function

I'm trying to create a Panel data using the plm function for pooling a model from a balanced Panel data that I imported from Excel. When I run the code I get the following error: Error in class(x) <- setdiff(class(x), "pseries") : invalid to…
jdoe
  • 13
  • 1
  • 3
1
vote
1 answer

R plm vs. Stata reghdfe

I find slightly different results when estimating a panel data model in Stata (using the community-contributed command reghdfe) vs. R. Stata: cls webuse nlswork, clear xtset idcode year reghdfe ln_w grade age ttl_exp tenure not_smsa south,…
safex
  • 2,398
  • 17
  • 40
1
vote
0 answers

R plm singular matrix issue

First question on the site. I have been following Princeton's plm package guide and have everything done (without errors). However, I am stuck in the last step of estimating a "random" effects model. I think my data fits a random model well, so this…
PBhGU123
  • 11
  • 2
1
vote
1 answer

R - fixed effect of panel data analysis and robust standard errors

I am working with the panel data through plm package in R. And now I am considering a fixed effect model of group (cities), time, and two ways of group and time, respectively. Because I detected heteroskedasticity through the Breusch-Pagan test, I…
Suralira.K
  • 33
  • 6
1
vote
2 answers

R: plm panel data: how to use pipes?

I have some panel data that looks like this (code to enter my dataset is at the end): countrycode year X 1 ARG 2015 2 2 ARG 2016 2 3 ARG 2017 1 4 AUS 2015 1 5 AUS 2016 3 6 AUS 2017 2 7 USA…
Jeremy K.
  • 1,710
  • 14
  • 35
1
vote
0 answers

How to cluster standard errors of plm at different level rather than id or time?

I run a panel regression by plm. plm only can cluster standard errors at "group" or "time" levels. But I want to cluster at the country level rather than group or time. (For my data, group is the firm level.) I use the following code to…
1412mm
  • 55
  • 7
1
vote
1 answer

Panel regression by group

I have searched many questions, but none of them is using plm. I have a firm-year panel data dt, each firm have different year observations. I have a panel regression: plm(y~ lag(x1, 1)+ lag(x2, 1)+ lag(log(x3), 1), data= dt, model= "within",…
1412mm
  • 55
  • 7
1
vote
0 answers

pgmm function in plm package errors: "number of rows of matrices must match"

I am trying to estimate a system GMM equation on a sample capital structure data, which I have unabled open access on google drive. I simply load the data, eliminate "NAs", make it pdata.frame then run the below code. Packages I use are : plm and…
krkc_bhdr
  • 61
  • 4
1
vote
1 answer

R and 'plm' package: how to use lapply to loop through columns of a 'pdata.frame' object

I am using the 'plm' package to carry out some simulations. I need to carry out a "within" transformation on all variables in a given dataset. A 'for' loop works fine, while the 'lapply' version does not. I create the dataset as: library(plm) data<-…
millo
  • 55
  • 5
1
vote
1 answer

Issue when loading or viewing a pdata.frame (cannot coerce class ""pseries"" to a data.frame)

I have issues with a specific dataset as following: 1)I load the table: Regression_990_DT<-fread("DATASET FINALE PER REGRESSIONE 990.R") 2)I use it to assign a pdata.frame: mypanel<- pdata.frame(Regression_990_DT, index = c("Individual","Year"),…
D-tack
  • 25
  • 6
1
vote
0 answers

Duplicate dates for fixed effects model

I am attempting to run a fixed effect model in plm. My two components are "Sector" and "Date" fixed <- plm(Value ~ Oil, data=Master, index=c("Sector", "Date"), model="within") The data looks like: Transportation , 03/09/2011 Transportation ,…
L-dan
  • 19
  • 2
1
vote
0 answers

R - plm package error - "system is exactly singular"

I am doing a panel data analysis in R using the plm package for a random effects regression model but I keep getting the following error message when I try to construct a random effects model: try: random <- plm(Y ~ X, data=pdata2, model="random")…
Restemayer
  • 5
  • 1
  • 3