Questions tagged [plm]

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

510 questions
2
votes
1 answer

Error computing Robust Standard errors in Panel regression model (plm,R)

I am using the plm library to run fixed effect regressions and the sandwich,lmtest libraries to compute robust standard errors. I have no problem running the regressions, but in some instances when I go to compute the standard errors I get the…
shadowprice
  • 617
  • 2
  • 7
  • 14
2
votes
0 answers

PLM falling into the dummy variable trap -- how to fix?

An example: load(url('BROKEN LINK')) head(sdat) library(plm) fem = plm(y~T+G:t,data=sdat,effect="twoways",model="within",index=c("ID","t")) summary(fem) lsdvm = lm(y~ID+T+G:t,data=sdat) summary(lsdvm) fem$coef fem is the fixed-effects model (fit…
generic_user
  • 3,430
  • 3
  • 32
  • 56
1
vote
0 answers

Having a problem to install fixest packages

Currently I am estimating IV regresssion with panel data. I thought, fixest packages is the good fit for the analysis. After it is showing some warning when I installed, I can't recall the library. The error is library(fixest) Error: package or…
1
vote
1 answer

Run a regression on "portion" of Panel data

I am working on a Panel Data that spans from 3rd February 2020 to 29th May 2020. In order to test my hypotheses, I need to run the same regression on the whole period and additionally on 3 different time periods: 03.02.2020 to 21.02.2020 24.02.2020…
genistae
  • 21
  • 2
1
vote
1 answer

IV regression in Fixed-Effect Models with diagnostics

I want to do an IV regression in Fixed-Effect Models with diagnostics (Wu-Hausman, weak instrument, etc.). I tried three options, each with its problem-- y is dependent variable x1 is the endogenous independent variable c1, c2, c3 are control…
user7453767
  • 339
  • 2
  • 14
1
vote
1 answer

plm::pdata.frame loses variable label attributes created by labelled::var_label?

I have a panel data to which I have applied plm::pdata.frame to be able to use the lag operator. However, once I have converted by dataframe to pdata.frame, the variable labels that I created using labelled::var_label do not show up in…
Anup
  • 239
  • 2
  • 11
1
vote
1 answer

Three Dimensional Panel Data: Granger Causality Test in R

I have data which is structured the following: As you can see, I have "multi-dimensional panel data", i.e. I do not only have years and countries, but also industries as a third "index". I did a panel regression analysis with the fixest package to…
Dom Slenk
  • 29
  • 2
1
vote
2 answers

R user function to run gmm model repeatedly using pgmm function

I have created a function to run gmm model repeatedly using pgmm function from plm package. here is the code. ``` run.gmm <- function(data, predictor, dep, controls, row.name = predictor, …
1
vote
1 answer

Linear regression with object oriented programming R

I need to run many similar regressions with small differences. As such, I want to create a class that creates different objects. How can I setMethodso that a linear regression is run within the object? I'm now using "show" and cat to define the…
Margaret
  • 15
  • 3
1
vote
0 answers

Twoway fixed effects equivalent for glm

What would be the plm twoway fixed effects equivalent for a logit-glm using maximum likelihood approach on a panel dataset? Pglm does not work for within model; And bife package allows for one fixed effect. I don’t want to apply a factor variable as…
Myr TH
  • 175
  • 1
  • 9
1
vote
0 answers

How to make a preliminary panel data fixed effect regression analysis

For my bachelor thesis I am researching the impact that demographic changes have on the economy. I compiled data from 12 different variables, and made a panel data. You can download it here :Data Data should look like this: I want to run some very…
1
vote
2 answers

Calculating the number of id's from a felm estimation

I'm estimating a series of country and year fixed-effects panel models using the felm function. I would like to calculate the number of countries included in each estimation. I can easily do this if I run my regressions using the plm function, as…
user3227641
  • 157
  • 7
1
vote
1 answer

2SLS standard errors with ivreg and plm in R

Could someone please confirm whether ivreg is calculating correct 2SLS standard errors by default or do I still have to manually correct them? I have an instrumental variable Z1 in my regression. library(ivreg) ivreg1 <- ivreg(log(Y) ~ log(X) + W1 +…
TFT
  • 129
  • 10
1
vote
0 answers

Applying plot_model() function to plm time fixed effect model

I am trying to generate an interaction plot using the following code: library(plm) FE <- plm(y~a*b+c,data=pdata, effect="time",model="within") summary(FE) plot_model(FE, type = "pred", terms = c("a", "b")) and I receive this error: Error in…
sustainex
  • 31
  • 1
1
vote
2 answers

Is it ok to run a plm fixed effect model and add a factor dummy variable (tree way fixed effects)?

Is it ok to run a "plm" fixed effect model and add a factor dummy variable in R as below? The three factors "Time", "Firm” and "Country" are all separate indices which I want to fix all together. Instead of making two indices in total by combining…
Eric
  • 528
  • 1
  • 8
  • 26