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
0 answers

How to calculate marginal effects for plm models

I wish to obtain marginal effects for covariates that are in my plm models in first differences with interacted variables. For my lm and glm models I am using the margins package and its functions. However, this method does not seem to work with…
2
votes
0 answers

Does first-difference work on unbalanced data with holes in plm?

On page 423 in Computational Laboratory for Economics, it is stated that "the argument model="fd" doesn't work correctly, with the current version (1.3-1) of plm, on unbalanced data with holes." Has this been fixed in the newer versions of plm? As…
M_M
  • 899
  • 8
  • 21
2
votes
1 answer

Create lag, lead and diff variables in plm dataframe

I am attempting to do some panel analysis using lagged, leading and differenced variables. However the plm functions do not provide the desired results as it does not loop over individuals. I have looked online, however the following post…
Gooze
  • 110
  • 1
  • 1
  • 11
2
votes
1 answer

Panel data models: Duplicate couples error when there are no duplicate couples

I have a panel data set with individual (dyad_id), which is an integer, and time (year_month) which is a Date variable. I try running the following code: df.fe <- plm(deaths_civilians ~ deaths_a_lag + deaths_b_lag, data =…
Lee Tagziria
  • 53
  • 2
  • 10
2
votes
1 answer

How to use stargazer/xtable with pggls objects from the plm package?

I'm trying to convert the output of some regression to latex with xtable or stargazer. I never had issues before, and the results of multiple regressions are organized neatly in a latex table. I'm using Fixed Effects FGLS. Therefore, I'm using the…
Mario GS
  • 859
  • 8
  • 22
2
votes
1 answer

FGLS Correcting Serial Correlation and heteroskedasticity with plm package in R

I am running a regression model with some heteroskedasticity and serial correlation and I am trying to solve both without changing my model specification. First, I have generated an OLS model and realized both problems, heteroskedasticity and…
2
votes
0 answers

Autocorrelation in Panel Data

I employed a random-effects plm model (from package plm) to estimate my coefficients and I used the vcovHC in order to correct for heteroskedasticity. However, how can I correct for autocorrelation as well? Should I use vcovNW or vcovSCC? because I…
Beatrice
  • 19
  • 2
2
votes
1 answer

plm with time effects

I'm trying to use the plm package in R for the first time. I wish to estimate a pooling model with only time dummies, i.e. no unobserved heterogeneity. I run a simple simple regression of the form: plm(dep ~ x:y -1, data=data, index=c("panel_var",…
Maarölli
  • 375
  • 1
  • 3
  • 13
2
votes
1 answer

Panel data: dealing with lagging and binary dependent variable with plm

I am attempting to run a pooled logistic regression with panel data and a binary dependent variable. Since I wanted to lag some of the variables, I used the plm package to create them. When I tried to do it other ways, I ran into problems. I…
Alison
  • 68
  • 1
  • 6
2
votes
0 answers

group cluster of several id's which belong together in the gmm approach using the plm package in R

I have established a gmm model with the Blundell Bond estimator and now I would like to cluster my individuals into groups. I already have a variable in my dataset (e.g. values 1-4). The aim is to capture the unobserved heterogeneity of this…
user3389108
  • 63
  • 1
  • 7
2
votes
2 answers

Extract the variance-covariance matrix from a plm fixed effects model

I would like to extract the variance-covariance matrix from a simple plm fixed effects model. For example: library(plm) data("Grunfeld") M1 <- plm(inv ~ lag(inv) + value + capital, index = 'firm', data = Grunfeld) The usual vcov function…
2
votes
1 answer

How to include categorical variables in pooled OLS using plm()?

Is there a way to include categorical variables (factors with several factor levels) when using plm() for pooled OLS? As far as I understand, in plm() all variables have to be numeric, which will not work in my case. I could include one dummy…
Aki
  • 409
  • 2
  • 6
  • 15
2
votes
1 answer

Robust standard error estimation for the Hausman-Taylor estimator using plm() and vcovHC()

Suppose I compute the Hausman-Taylor estimator using the plm command with the option: model= "ht". Using the result I like to obtain a robust variance-covariance matrix to make inference fully robust. For this purpose the vcovHC() command (part of…
Manuel R
  • 3,976
  • 4
  • 28
  • 41
2
votes
2 answers

obtaining average coefficients and adj. R^2 from multiple pooled regressions using lapply

I have performed multiple Pooled regressions with a loop function and stored the regression output in a list (myregression). What I would like to do now is to efficiently perform the coeftest function in the lmtest package over all my regressions…
Gritti
  • 85
  • 3
  • 11
2
votes
0 answers

R packages effects & plm : "error in contrasts" when trying to plot marginal effects

After reading this answer on error in contrasts and reviewing my data I am still stuck with a problem when trying to combine packages 'plm' and 'effects'. This might be impossible as John Fox does not discuss this possibility in his effects document…
SJDS
  • 1,239
  • 1
  • 16
  • 31