Questions tagged [plm]

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

510 questions
5
votes
2 answers

R / plm extract residuals by index

I have a plm object created using: require(plm) plm1 <- plm(Sepal.Length ~ Petal.Length + Petal.Width, data = iris, index = "Species") I'm trying to extract the residuals to manually calculate r-squared by Species by can't seem to manipulate the…
screechOwl
  • 27,310
  • 61
  • 158
  • 267
5
votes
2 answers

Fixed effects regression in R (with a very large number of dummy variables)

Is there an easy way to do a fixed-effects regression in R when the number of dummy variables leads to a model matrix that exceeds the R maximum vector length? E.g., > m <- lm(log(bid) ~ after + I(after*score) + id, data = data) Error in…
John Horton
  • 4,122
  • 6
  • 31
  • 45
5
votes
1 answer

R/plm: Cannot estimate random effects model due to error (system is computationally singular)?

I would like to estimate some panel data models in R using PLM package. Because of restricted knowledge in theory, I am strictly following the instructions from "econometrics academy" (code here). I customized that code with respect to my data (own…
user3405263
  • 51
  • 1
  • 3
5
votes
1 answer

Hausman type test in R

I have been using "plm" package of R to do the analysis of panel data. One of the important test in this package for choosing between "fixed effect" or "random effect" model is called Hausman type. A similar test is also available for the Stata. The…
Metrics
  • 15,172
  • 7
  • 54
  • 83
4
votes
1 answer

Why does plm not like my dplyr-created dataframe?

If I perform simple and seemingly identical operations using, in one case, base R, and in the other case, dplyr, on two pdata.frames and then model them with lm(), I get the exact same results, as expected. If I then pass those datasets to plm(),…
snowpeak
  • 43
  • 5
4
votes
1 answer

How to Plot the "time" effects results from PLM/ Fixest?

I am running a fixed effects model with a continuous variable (say parental wealth) on another continuous variable (children's wealth). I have a few control variables as well. I want to plot the relationship between X and Y, over "Time". Is it…
NanoBot
  • 837
  • 1
  • 7
  • 10
4
votes
1 answer

How to do granger causality test after panel vector autoregression (pVAR) in R?

How to do granger causality test after running a panel vector autoregression in R (using the panelvar package)? In order to run the panel VAR, one could do the following: library(plm) library(panelvar) set.seed(12345) x = rnorm(240) z = x +…
Miranda
  • 148
  • 13
4
votes
0 answers

SPML (spatial panel models): Error in lag.listw | unbalanced panels

I am making spatial panel models from the splm library but I cannot make a fixed or random effects model because it comes out that it is an unbalanced panel. Data data and shp files Reproducible…
cdcarrion
  • 574
  • 6
  • 22
4
votes
2 answers

F-test on Fixed Effects in R (Panel Data)

I am trying to do an F-test on the joint significance of fixed effects (individual-specific dummy variables) on a panel data OLS regression (in R), however I haven't found a way to accomplish this for a large number of fixed effects. Ideally, I…
baha-kev
  • 3,029
  • 9
  • 33
  • 31
4
votes
1 answer

plm: Fixed Effects Regression - Index / ID order

I am running fixed effects regressions using the plm package. Why and how does the order of the ID code have an impact on the regression? I used these codes for running the regressions, which only differ between the order of the ID code Company and…
Aria T
  • 43
  • 1
  • 4
4
votes
1 answer

How to include a spatial lag of an explanatory variable in a panel spatial model?

I am doing a spatial durbin model with spml function (splm package), I have included as regressors a polynom (grade 2) and obviosly I need to include its spatial lag too. Unfortunately the function slag and lag.listw don't work with a poly…
Silvia
  • 41
  • 1
4
votes
0 answers

R: Error in terms.default(formula) : no terms component nor attribute (pgmm function)

I try to learn how to use the GMM method with R (Arellano-Bond estimator). So I use the pgmm command from the package plm. I reproduced the code of this example: https://www.rdocumentation.org/packages/plm/versions/1.6-5/topics/pgmm with these…
J.Martin
  • 41
  • 3
4
votes
0 answers

Cluster-robust errors for a plm with clustering at different level as fixed effects

How does one get multiway clustered standard errors in R for plm objects, where the clustering is not at the level of the panel's time/group IDs? The package plm provides support to calculate cluster-robust standard errors using the function…
wjw
  • 41
  • 1
4
votes
1 answer

Lapack routine dgesv in pgmm function of plm package

lately I met a problem that took me quite a long time to figure it out but could not in the end. I want to use pgmm function in the package plm to produce GMM estimate on a cross-section country data including 180 countries and 65 time periods. Here…
exteral
  • 991
  • 2
  • 12
  • 33
4
votes
1 answer

Error when trying to run fixed effects logistic regression

not sure where can I get help, since this exact post was considered off-topic on StackExchange. I want to run some regressions based on a balanced panel with electoral data from Brazil focusing on 2 time periods. I want to understand if after a…
1 2
3
33 34