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

How to turn year fixed-effects into decade fixed-effects with plm()?

For my bachelor thesis I have a regression with fixed-effects and time-fixed effects in years: log⁡(production_it )= β_0 + β_1 * log⁡(temp_it ) + β_2 * log⁡(rain_it ) + β_3 * drought_it + β_4 * flood_it + β_5 * storm_it + β_6 * log⁡(labour_it )+…
mag123
  • 21
  • 3
1
vote
0 answers

Does the plm() have a consistent intercept?

I am new here :) I want to use the following equation for my bachelor thesis: log⁡(production_it )= β_0 + β_1 * log⁡(temp_it ) + β_2 * log⁡(rain_it ) + β_3 * drought_it + β_4 * flood_it + β_5 * storm_it + β_6 * log⁡(labour_it )+ β_7* …
mag123
  • 21
  • 3
1
vote
0 answers

How to produce Parallel Trends table and graph in R?

I have been performing panel estimations with municipality fixed effects. I would like to produce robustness checks to verify my results. One of the these is the proof of parallel trends. How can I do this with R? Say I perform 3 regressions for 3…
1
vote
1 answer

Why PanelOLS in python has different result than plm in R

I am doing a fixed effect model using PanelOLS in Python, and I have use plm in R to validate my result, to my surprise, the coefficient and P values are different between these two, even though they are supposed to be the same? Data is from R’s…
Ltng
  • 35
  • 8
1
vote
1 answer

How to omit redundant huge information?

I want to create a function which will perform within panel regression : My work so far library(plm) fit_panel_lr <- function(y, x) { x <- cbind(as.data.frame(x),as.data.frame(y)) varnames <- names(x)[3:(length(x))] varnames <-…
John
  • 1,849
  • 2
  • 13
  • 23
1
vote
1 answer

Dummies not included in summary

I want to create a function which will perform panel regression with 3-level dummies included. Let's consider within model with time effects : library(plm) fit_panel_lr <- function(y, x) { x[, length(x) + 1] <- y #adding dummies mtx <-…
John
  • 1,849
  • 2
  • 13
  • 23
1
vote
1 answer

Adding robust standard errors to original panel model in R

I use a within plm model: model <- plm(Y ~ x1 + x2 + x3, data=dataset, model="within", effect="twoways") I detected heteroskedasticity and calculated robust standard errors with the vcovHC function from the plm package: coeftest(model, vcov =…
tomankid
  • 29
  • 1
  • 6
1
vote
1 answer

Plotting interaction terms from fixed effects models (plm)

I'm trying to plot interaction effects from a fixed effects model. For some reason, I always get the same error message: Error in crossprod(beta, t(X)) : non-conformable arguments First I thought this was only my data (maybe multicollinearity) but…
1
vote
1 answer

Why does my fe with demeaned data ( lm() ) not reproduce coefficients from plm(), lfe() and lsdv?

I am trying to reproduce fixed effects coefficients for panel data using different packages and techniques: (1) plm(), (2) lfe(), (3) dummy-lsdv with lm(), and (4) demeaned-fe with lm(). My data set consists of 1581 observations and 13 variables. It…
Ane Yla
  • 93
  • 1
  • 4
1
vote
1 answer

Windmeijer correction for Arellano-Bond Test in R package plm

Let´s suppose I have a simple AR(1) panel data model I estimate with the pgmm command in R - data available : library(plm) library(Ecdat) data(Airline) reg.gmm = pgmm(output ~ lag(output, 1)| lag(output, 2:99), data= Airline, Robust=TRUE) With…
1
vote
1 answer

Need to declare panel data before using plm?

Simple question but before estimating a FE regression using plm – do I need to "set" the df as panel data using plm.data (similar to xtset in Stata)? pdata <- plm.data(df, index = "state", "year") I thought including "index" in the regression…
Anna Bokun
  • 55
  • 7
1
vote
0 answers

FELM with Interaction Terms

I'm trying to estimate the follwing model using the felm function from lfe package. enter image description here But I don't know how to include the γit interaction term of state dummies and the post-1937 dummy. I tried setting state_pc:post-1937 as…
yamyam112
  • 11
  • 1
1
vote
0 answers

R / PLM Package: How to include a nested effect for the same brands across countries?

I am currently analyzing a panel data set, which tracks brands across countries over time.In particular, I am interested in how certain variables are impacting future market share. Using the head() function, my data set looks as followed: # A…
Sven
  • 11
  • 2
1
vote
1 answer

Is there any R function that visualize the interaction effect of IV regression?

I'm looking for a function for interaction effects visualization which has a correspondence with ivreg or plm. My model is 2sls with fixed effects but it seems there are no packages available for calculating interaction effects in R. I'd be pleased…
MasK
  • 71
  • 4
1
vote
0 answers

Rolling window regression for panel data

I would like to perform a rolling window regression for panel data over a period of 36 months and get the monthly intercept as output. My data has 1397 Funds (ID) with 252 monthly returns each. ï..ID Period Return RMRF SMB5 …
Lena
  • 11
  • 2