plm

Problems with multicollinearity in Panel Granger Causality Test

若如初见. 提交于 2020-01-17 00:36:07
问题 I'm investigating the effect of FDI on Freedom and want to apply the Granger Causality Test in panel context. I use the "pgrangertest" from the plm package, which includes the heterogeneity of the observations. The problem is that it gives me the following output: Error in waldtest.lm(fm, 2, ...) : there are aliased coefficients in the model In other words, multicollinearity is the problem. The alias test, as well as the VIF test (shows 1), confirm this assumption. BUT: It tells me that all

Extract all individual slope coefficient from pooled OLS estimation in R

橙三吉。 提交于 2020-01-06 06:23:06
问题 I hit a problem where I want to extract all individual coefficient of a particular variable in a pooled regression. My data look like this and I regress Y on X. Observation name date Y X 1 A 1 Y1 X1 2 A 2 Y2 X2 3 B 1 Y3 X3 4 B 2 Y4 X4 Using the plm package and summary, R only gives me one coefficient of X. However, I want to have coefficient of X variable in each individual regression. Can anyone help me with this? To clarify, what I want is all the beta associated with the X_n,1 in the below

Residuals from first differenced regression on unbalanced panel

假装没事ソ 提交于 2020-01-01 18:55:46
问题 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 have run into two problems, I don't know how to attach residuals to the observation they are associated with, and I seem to get an incorrect number of residuals. If I retrieve the residuals from the estimated model using model.name$residuals, I get a

Residuals from first differenced regression on unbalanced panel

别来无恙 提交于 2020-01-01 18:55:13
问题 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 have run into two problems, I don't know how to attach residuals to the observation they are associated with, and I seem to get an incorrect number of residuals. If I retrieve the residuals from the estimated model using model.name$residuals, I get a

Clustered standard errors different in plm vs lfe

北慕城南 提交于 2019-12-31 22:26:51
问题 When I run a cluster standard error panel specification with plm and lfe I get results that differ at the second significant figure. Does anyone know why they differ in their calculation of the SE's? set.seed(572015) library(lfe) library(plm) library(lmtest) # clustering example x <- c(sapply(sample(1:20), rep, times = 1000)) + rnorm(20*1000, sd = 1) y <- 5 + 10*x + rnorm(20*1000, sd = 10) + c(sapply(rnorm(20, sd = 10), rep, times = 1000)) facX <- factor(sapply(1:20, rep, times = 1000))

Waldtest in R to get adjust F statistic with plm and result shown with stargazer?

谁说我不能喝 提交于 2019-12-25 04:49:15
问题 I am working with an unbalanced short panel. Raw data: bankFull.xlsx What I actually want is only get the regression results with two side fixed effects and robust S.E reported, which is very easy in Stata. I followed online tutorial but ran into some problem always with # Adjust F statistic wald_results <- waldtest(FE1, vcov = cov1) Error in model.matrix.pFormula(formula, data, rhs = 1, model = model, : NA in the individual index variable no matter how I adjusted the data! It almost drives

R: No way to get double-clustered standard errors for an object of class “c('pmg', 'panelmodel')”?

一世执手 提交于 2019-12-24 13:22:29
问题 I am estimating Fama-Macbeth regression. I have taken the code from this site fpmg <- pmg(Mumbo~Jumbo, test, index=c("year","firmid")) summary(fpmg) Mean Groups model Call: pmg(formula = Mumbo ~ Jumbo, data = superfdf, index = c("day","Firm")) Residuals Min. 1st Qu. Median Mean 3rd Qu. Max. -0.142200 -0.006930 0.000000 0.000000 0.006093 0.142900 Coefficients Estimate Std. Error z-value Pr(>|z|) (Intercept) -3.0114e-03 3.7080e-03 -0.8121 0.4167 Jumbo 4.9434e-05 3.4309e-04 0.1441 0.8854 Total

Error in loadNamespace, object 'vI' not found with package plm

徘徊边缘 提交于 2019-12-23 03:28:15
问题 I never had problems with installing packages before. When I first tried to install the plm package, it gave me an error saying that package pbkrtest was not installed. So I tried installing pbkrtest , but install.packages("pbkrtest") did not work, it gave me this error message: install.packages("pbkrtest") Installing package into ‘C:/Users/Flo/Documents/R/win-library/3.2’ (as ‘lib’ is unspecified) Warning in install.packages : package ‘pbkrtest’ is not available (for R version 3.2.2) I

Fixed Effects plm package R - multiple observations per year/id

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 03:16:05
问题 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 regression that accounts for all three races. I do this by using state, year and race all as factor variables. I am also running separate regressions for each individual race. The problem is that I would prefer to use the plm package so that i can

Double clustered standard errors for panel data

戏子无情 提交于 2019-12-17 18:33:33
问题 I have a panel data set in R (time and cross section) and would like to compute standard errors that are clustered by two dimensions, because my residuals are correlated both ways. Googling around I found http://thetarzan.wordpress.com/2011/06/11/clustered-standard-errors-in-r/ which provides a function to do this. It seems a bit ad-hoc so I wanted to know if there is a package that has been tested and does this? I know sandwich does HAC standard errors, but it doesn't do double clustering (i