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

Panel regression with ar1 model

Excuse my naiveté. I'm not sure what this type of model is called -- perhaps panel regression. Imagine I have the following data: n <- 100 x1 <- rnorm(n) y1 <- x1 * 0.5 + rnorm(n)/2 x2 <- rnorm(n) y2 <- x2 * 0.5 + rnorm(n)/2 x3 <- rnorm(n) y3 <-…
user111024
  • 723
  • 3
  • 15
1
vote
1 answer

Several coefficients for the same independant variable in panel data model in R

I am using the plm package in R to estimate the following simple panel data model: X1 ~ X2 for 22 countries and 18 years (annual data). Below, you can find an extract of my data for reproducible example. My code is the following: form <- X1 ~…
tristanjou
  • 35
  • 8
1
vote
2 answers

What's the best way to turn a POSIX datefield into some time index that is accepted by plm?

I trying out the plm package for some first difference estimation in R. As stated in the title I wonder how I can turn my POSIX dates like "2002-10-01" into values that are understood by plm's time index. I guess this means using integer…
Matt Bannert
  • 27,631
  • 38
  • 141
  • 207
1
vote
0 answers

Error in R: Lapack routine dgesv: system is exactly singular: U[10,10] = 0

I want to use pgmm function in the package plm to produce GMM estimate on a cross-section country data including 4 countries and 20 time periods (quarterly 5 years) Here is my code: formula = log(y2) ~ lag(log(y2),1) + lag(log(y2),2) + EU_IM + …
R.M
  • 11
  • 4
1
vote
1 answer

How do I control for unit-specific trend in a panel regression with plm

I am working with panel data using the plmpackage in R and need to specify a state and year fixed effects model with linear state-specific trends. I have the following code so far: pnl_sb <- pdata.frame(seatbelt.df, index = c("fips","year")) twyreg…
Collective Action
  • 7,607
  • 15
  • 45
  • 60
1
vote
1 answer

R: Using a variable with less observations in a regression (plm)

I have been trying to deal with this for a while now with no luck. Essentially, what I am doing is a two-stage least squares on some panel data. To do this I am using the plm package. What I want to do is Do a 2SLS Get the residuals from the 2SLS…
student_t
  • 243
  • 2
  • 9
1
vote
0 answers

PLM package: Balanced data shown as unbalanced in regression

The dataset which I am using here is unbalanced, but I balanced it manually like this by removing the multiple observations for same ID (this is a characteristic of my data as a single household later split to different ones). T is 2 here. dataset…
Arya
  • 11
  • 1
1
vote
2 answers

Extract all individual slope coefficient from pooled OLS estimation in R

I hit a problem where I want to extract all individual coefficient of a particular variable in a pooled regression. My data look like this and I regress Y on X. Observation name date Y X 1 A 1 Y1 X1 2 A 2 Y2 X2 3 …
1
vote
0 answers

regression results summary takes so long that makes me really confusing?

I am currently working on panel data (using the plm package) with around 10 variables and only 30.000 observations. When I turn the option in plm() command from effect = "individual" to effect = "twoways", the calculation time takes ca. 1 minute,…
1
vote
0 answers

Forecasting with plm [panel regression]

I am having some troubles with forecasting panel data using the fixed model of the plm pachage. I know that it does not have a built-in forecasting function, so I want to compute the out-of-sample forecasts by hand. Is my logic correct: fixed <-…
Masher
  • 133
  • 1
  • 7
1
vote
1 answer

How does the plm package handle fixed effects - one dummy for each individual or one less?

I am currently trying to get used to the plm package and tried to make a fixed effects with individual effects (just for the sake of doing it, please ignore the misspecification) with the plm() function and then with the lm() function. I found that…
1
vote
1 answer

Error in x[, ii] : subscript out of bounds with plm package

Whilst running the following line of code: Pfit1 = plm(hits ~ countDir, data = Pdf1, model = "within" , effect = "twoways") I get the following error: Error in x[, ii] : subscript out of bounds However, I do not know where to go from here as I…
nemja
  • 459
  • 4
  • 19
1
vote
2 answers

Getting a subset of variables in R summary

When using the summary function in R, is there an option I can pass in there to present only a subset of the variables? In my example, I ran a panel regression with plm() (from package plm) I have several explanatory variables, and have many dummy…
splinter
  • 3,727
  • 8
  • 37
  • 82
1
vote
1 answer

R: No way to get double-clustered standard errors for an object of class "c('pmg', 'panelmodel')"?

I am estimating Fama-Macbeth regression. I have taken the code from this site fpmg <- pmg(Mumbo~Jumbo, test, index=c("year","firmid")) summary(fpmg) Mean Groups model Call: pmg(formula = Mumbo ~ Jumbo, data = superfdf, index =…
Polar Bear
  • 731
  • 1
  • 7
  • 21
1
vote
1 answer

panelAR for panel OLS regression

In performing a panel data regression using the panelAR function, setting autoCorr = "none" and panelCorrMehotd = "none", what specific correction is being performed to the standard errors? I would imagine it would be equal to those of an OLS…