R package primarily concerned with panel data. Package contains a set of estimators and tests for panel data.
Questions tagged [plm]
510 questions
4
votes
1 answer
Fixed Effects plm package R - multiple observations per year/id
I'm working on a state and year fixed effects regression, which has 3 observations per state/year combo based on the race for that row (white, black, other) - See link below.
So far, I've been using the base lm function to estimate a fixed effects…

dmunslow
- 149
- 1
- 7
4
votes
1 answer
Get data observations used by regression in R (plm)
I am estimating a panel model with the package plm.
Some of the individuals in the panel do not have data for all the explanatory variables, so they are excluded from the regression.
How could I see which particular observations have been used for…

user3507584
- 3,246
- 5
- 42
- 66
4
votes
1 answer
Predicting with plm function in R
I was wondering if it is possible to predict with the plm function from the plm package in R for a new dataset of predicting variables. I have create a model object using:
model <- plm(formula, data, index, model = 'pooling')
Now I'm hoping to…

Michael
- 1,281
- 1
- 17
- 32
4
votes
1 answer
Residuals from first differenced regression on unbalanced panel
I am trying to use plm to estimate a first differenced model on some unbalanced panel data. My model seems to work and I get coefficient estimates, but I want to know if there is a way to get the residual (or fitted value) per observation used.
I…

Misophist
- 55
- 3
4
votes
1 answer
R: plm individual and time fixed effects but no other regressors
I want to run a regression including only time and individual fixed effects (i.e. no other right-hand side variables).
I try to do this with plm:
plm(y ~ -1,data=data, effect="twoways", model="within")
However, the syntax is not correct, nor does…

Maarölli
- 375
- 1
- 3
- 13
4
votes
0 answers
R: plm - restricting coefficients
I want to restrict some cofficients in plm model in R. For example, if I have such a model:
library(plm)
data("Produc", package = "plm")
zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
data = Produc, index =…

bluecat
- 41
- 4
4
votes
1 answer
"Non conformable arguments" error with pgmm (plm library)
I am unsuccessfully trying to do the Arellano and Bond (1991) estimation using pgmm from the plm package. To see if the problem was in my data, I instead used the data supplied i the plm library, but got the same problem when using the "summary"…

Björn Backgård
- 148
- 1
- 10
4
votes
1 answer
View all estimates in plm output in R
I'm trying to run plm to see effects of classes positive, negative and neutral on stock prices.
DATE <- c("1","2","3","4","5","6","7","1","2","3","4","5","6","7")
COMP <- c("A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B")
RET…

cptn
- 693
- 2
- 8
- 28
4
votes
1 answer
Looping subsets in plm
I'm trying to program something quite simple (I think) in R, but I can't seem to get it right. I have a dataset of 50 countries (1 to 50) for 15 years each and about 20 variables per country. For now I am only testing one variable (OS) on my…

user3352474
- 41
- 3
4
votes
2 answers
Generating a lagged time series cross sectional variable in R
I am a new R user. I have a time series cross-sectional dataset and, although I have found ways to lag time series data in R, I have not found a way to create lagged time-series cross-sectional variables so that I can use them in my analysis.

Julie
- 43
- 1
- 3
3
votes
1 answer
Plot a plm model in R
I have a large panel which I am estimating via plm with fixed effects.
For example
Test.fe <- plm( Y ~ x1+x2, data=test, model="within")
I used summary(Test.fe) to print the estimating results and to get the fixed effects, it is possible to use…

Andre
- 105
- 2
- 7
3
votes
1 answer
R plm vs fixest package - different results?
I'm trying to understand why R packages "plm" and "fixest" give me different standard errors when I'm estimating a panel model using heteroscedasticity-robust standard errors ("HC1") and state fixed effects.
Does anyone have a hint for me?
Here is…

minimouse
- 131
- 10
3
votes
2 answers
Predict out of sample on fixed effects model
Let's consider model :
library(plm)
data("Produc", package = "plm")
model <- plm(pcap ~ hwy + water, data = Produc, model = 'within')
To calculate fitted value of the model we just need to use :
predict(model)
However, when trying to do this out…

John
- 1,849
- 2
- 13
- 23
3
votes
2 answers
How to get between and overall R2 from plm FE regression?
Is there a way to get plm() to calculate between R2 and overall R2 for me and include them in the summary() output?
To clarify what I mean with between, overall, and within R2 see this answer on StackExchange.
My understanding is that plm only…

BeSeLuFri
- 623
- 1
- 5
- 21
3
votes
2 answers
How to balance an unbalanced panel data?
Suppose I have the following unbalance pandel data:
unbalanced.panel = structure(list(firm = c("A", "A", "A", "A", "B", "B", "A", "A",
"B", "C", "C"), ind = c(1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1), year = c(2010,
2011, 2012, 2013, 2011, 2013, 2011,…

Cristhian
- 361
- 3
- 12