514 questions
0
votes
0
answers
28
views
Cipstest in plm library: Error in xy.coords(x, y, setLab = FALSE) : 'x' and 'y' lengths differ
Here is a dataset I want to run Pesaran's panel unit root test using the cipstest function in the plm library.
It keeps giving me the error "x and y lengths differ", and I cannot sort this ...
2
votes
1
answer
62
views
Issue with predict.plm() when using lag() inside the regression
I've recently encountered a problem with predict() function for plm regression that uses AR(1) term in form of lag().
Here is an toy example: 3 countries, 3 periods, current population as a function a ...
0
votes
1
answer
177
views
How do I read the results of a Hausman Test for a fixed effects and half-fixed effects model in R (using the plm package)? [closed]
I have 3 models for measuring how trading size (amount) affects bond prices.
I'm using the plm and fixest packages.
I have a random effects model:
random_model <- plm(Price ~ Amount + control, data ...
0
votes
1
answer
64
views
Set fixed effects at a different variable than a panel index variable
I am trying to run a plm panel fixed effects model. The panel index runs at the county-year level. The challenge? I want to run fixed effects at the (higher order) state level. I can easily program ...
1
vote
1
answer
508
views
Clustered/Robust standard errors in R
I am estimating an OLS regression without fixed effects and an OLS regression with fixed effects in R Studio. I have read, that it is common to use robust standard errors, when estimating a simple OLS ...
1
vote
1
answer
662
views
HAC standard errors in R using plm package?
I want to estimate a fixed effects model (with both country- and year fixed effects) and ADDITIONALLY apply HAC standard errors. Although I didn't get any error message after running the following ...
1
vote
1
answer
81
views
Two-way fixed effect estimation via `plm` fails with an error message (but works via `lm`)
I am trying to run a two-way fixed-effects panel regression using plm in R. First, I randomly generate some data. Then I create time and firm indices (two-way indexing as usual in a panel dataset) and ...
1
vote
2
answers
447
views
Bootstrap panel data: randomly selecting individuals, not the person-waves
I am trying to replicate the Stata code (available here) in R. The idea is randomly selecting bootstrap sample from the idcode, not the
idcode-year and then estimate
the parameters from the selected ...
1
vote
1
answer
149
views
PLM package: Difference between PMG and PCCE function
What is the difference of pmg and pcce function in package plm? Details of both is almost same in the description. I wanted to perform mg, pmg and CCE mg test on panel data using plm function. I ...
1
vote
1
answer
102
views
Fixed-effects regressions with Amelia object
I have time-series cross-sectional data with missing data. I have imputed the data with Amelia, but I encounter two error when I try to run my fixed effect regressions. First, if I do not specify the ...
0
votes
1
answer
111
views
Add overall intercept to stargazer table in R in panel data analysis fixed effects model
I wish to add the overall intercept of a fixed effects model ("within" panel data analysis). This is common practice in Stata and I wish to mimic the Stata output by including the overall ...
0
votes
2
answers
195
views
Creating T-1 variable | R [duplicate]
I would like to create a new variable sales.T.minus.1 which will present the value of sales from year - 1. I created a replicable example below:
library(plm)
library(dplyr)
data <- pdata....
0
votes
0
answers
157
views
How to do interrupted time series analysis using R's plm?
I am trying to model the following interrupted time series model:
y = b0 + b1*time + b2*event + b3*time_since_event
The data, however, is nested inside users (id). Currently, I have the following ...
0
votes
1
answer
802
views
Display plm Model Results: Marginal Effects, p-Values for Interaction Terms, and Plots (Fixed Effects Method)
I'm working with panel data using the plm package in R to estimate a fixed effects model that includes interaction terms. I'm currently able to get my model results using plm and display them with ...
0
votes
0
answers
41
views
FIxed effects with plm, problem with NaNs
I am trying to run a time-fixed effects regression with plm using the wbstats library. I have attached an image of the dataset for reference. I am rather new to this.
Model:
AfricaTotal <- plm(...
0
votes
0
answers
67
views
exporting multiple regression results in R
New R user here.
I have a bunch of regression models that can get quite big, and I'm trying to find some way to export the results into a latex table using stargarzer.
structure(list(country = ...
0
votes
1
answer
212
views
How can I create panel dataset with transaction data using plm package in R?
I want to do panel regression R and use multiple fixed effects.
I am trying to construct panel dataset first by using pdata.frame function, but I am not sure whether I am doing it right.
I have trade ...
0
votes
1
answer
237
views
How to make GMM tests appear in stargazer?
I am doing a lot of GMM regressions and need to report all tests. I'm using plm and stargazer package for this.
However, stargazer does not provide this tests directly, so I wrote a long code to add ...
0
votes
1
answer
55
views
Troubleshooting GWPR/PLM duplicate couples error
I am trying to run a Geographically weighted panel regression model as seen below.
However I keep on getting an error of duplicate ids.
bw.GWPR(formula = formula1, data = finalprepostdataset3,
...
0
votes
0
answers
88
views
Warning message when I run the plm function for fixed effects
I don't understand what's happening in RStudio. After running the plm function for fixed effects estimators, I get a warning that appears for whatever I type in R. The warning is
In if (n >= ...
1
vote
1
answer
702
views
Reporting heteroscedasticity-robust standard errors in modelsummary for panel data (plm)
I encounter a problem with the reporting of heteroscedasticity-robust standard errors for a panel data regression (plm) in the output with modelsummary. For a simple linear regression the reporting ...
0
votes
1
answer
32
views
Balanced Panel -n and T are mixed up
I have a fix effects model like this:
Indeksy <- updata.frame(PiS, index = c("Rok","Powiat")))
fixed_effects_model_05_07 <- plm(Logarytm_Wynik_Wyborczy_05_07 ~ ...
0
votes
1
answer
194
views
Insufficient Number of Instruments Error PLM IV on Unbalanced Panel
I am attempting to run the following IV regression on an unbalanced panel dataset. The variables TOTAL_E, TOURISM_5k_SUM and TOURISM_10K_SUM are endogenous, while HHSIZE2 and SEX are exogenous ...
1
vote
0
answers
79
views
Error when estimating a spatial panel model with splm::sp
I am trying to estimate a spatial panel model with spml. The data (bp_sf_subset) nests years (2013-2019) within 690 block groups and has no missing values. I used the following code to obtain the ...
0
votes
3
answers
707
views
Panel Data Fixed effects regression in R using PLM package with multiple obs/yr
I have a panel data:
Panel Data set - gravity model international trade
My R code:
#importing dataset
df <- read_excel("DataSet_Final.xlsx",
col_types = c(&...
0
votes
0
answers
96
views
Better estimate three level panel data with plm() or lmer()?
I have a question about an analysis I want to perform with panel data with three levels.
Am i correct if because it's panel data, plm() (from package plm) would be more appropriate, however it does ...
0
votes
1
answer
242
views
pvcm function of plm package: insufficient number of observations
I was doing panel data regression on this data set
Panel <- foreign::read.dta("http://dss.princeton.edu/training/Panel101.dta")
I tried this code
library(plm)
grun.tvarw <- pvcm(y ~ ...
1
vote
0
answers
456
views
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.
...
2
votes
0
answers
136
views
Estimation problem with Difference in Difference - Within model twoways effect
I need to estimate a difference-in-difference regression to understand the effect of a policy on various municipalities. I have a dataset that spans from 2001 to 2019, covering almost 7,900 ...
0
votes
0
answers
36
views
lag function returning contemporaneous values
I am using the lag function (package plm) which is returning me the contemporaneous value, not the lagged one.
In this code regarding a panel of data (years, agencies), the chg variables is filed with ...
0
votes
0
answers
299
views
Fama Macbeth Regression in R: the correct code
I want to run a Fama-MacBeth regression in R. My dataset has a few independent variables and date and ticker variables. I have run a code as follows: prepared two codes but their output is different. ...
0
votes
1
answer
564
views
Pesaran CD test on panel data
I am trying to do the Pesaran CD Test on some panel data on Italian Provinces. For each unit I have 22 years, each one splitted in quarters (so 92 observation for each unit).
The variable "...
0
votes
0
answers
482
views
R - How to do a residual vs. fitted values with a fixed effects model (plm package)
I estimated a two-way (meaning individual and time FE) fixed effects model with the plm package. The code I used for my regression is :
my_plm_model <- plm(Y ~ X, data = my_data, model = "...
0
votes
2
answers
912
views
Efficient creation of dummy variables in fixed effects regression
I have time panel data of 34 countries that describes on which days they have committed to giving military aid in €. I am running a fixed effects regression to study how the sum of this aid changes ...
4
votes
1
answer
79
views
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 ...
0
votes
1
answer
220
views
What are the commands to conduct DWH test and overidentifying restrictions tests when dealing with panel data?
All the ressources I find on the internet show me how to conduct a Durbin-Wu Hausman test and an overidentifying restrictions test on cross-sectional data.
How could I do these tests in R with fixed ...
0
votes
1
answer
364
views
How to run weighted panel regression with PLM packege in R
I want to run a panel regression in R with the help of plm. Its basic function has a parameter weights, but I cannot understand in what way and format I have to put it there. Can any one help
Consider ...
2
votes
1
answer
913
views
Predict out of sample on fixed effects model with fixest
Is there a way to make predictions from a fixest model on an observation that has an out-of-sample fixed effects level? I would like this prediction to be based on the weighted mean of the existing ...
0
votes
0
answers
79
views
Losing year dummy when running 'within' plm in R
I'm working through question C3i in Wooldridge's Intro to Econometrics text and running the following code:
library(wooldridge)
library(plm)
jtrain.p <- pdata.frame(jtrain,index=c("fcode",...
0
votes
1
answer
352
views
Error of "non-unique values when setting 'row.names'", after setting explicit unique row names
here is a weird one:
I am working on the following data frame:
str(ccomb)
'data.frame': 358 obs. of 36 variables:
$ Country.Name : chr "Albania&...
0
votes
1
answer
123
views
Robust F Test with PLM regression in R
I'm trying to run a robust F-Test using a PLM object in R. I'm running the following code:
library('wooldridge')
data(wagepan,package='wooldridge')
library('plm')
pdata<-pdata.frame(wagepan,index=c(...
0
votes
0
answers
479
views
Why doesn't fixed effects regression using lm function drop time-invariant variables?
Unit-fixed effects regression is supposed to drop time-invariant variables because time-invariant variables are absorbed by unit-fixed effects. This happens when we use plm function, but not with lm ...
0
votes
0
answers
171
views
Is there an R function for Fixed Effect AR(1) Disturbances?
I'm trying to do a Fixed Effect analysis with AR(1) Disturbances.
From research, I found that there was a package called panelAR that incorporated the fixed effect analysis with autoregression ...
1
vote
1
answer
229
views
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 ...
0
votes
1
answer
224
views
IPS test using the plm R package gives different T-rho values from individually pefromed ADF test statistics
I have been throught the Im, Pesaran and Shin paper many times to solve this issue but have failed so far.
When I perform the IPS test in R using the plm package [purtest() function] I get exactly the ...
0
votes
1
answer
373
views
How to force my intercept in my regression to be 0 using the plm package in R?
I am working on a regression where my dependent variable is abnormal earnings growth divided by the book value of equity (AEG_BV) and my independent variable is the lagged version of AEG_BV. I want to ...
1
vote
0
answers
126
views
Find number of instruments plm package R
I am using the plm package for the GMM.
How can I see what is the number of instruments used?
Here is my code:
z1.ABquad <- pgmm(cpi ~ lag(cpi, 1:1)+lag(gdppc, 4:4) + lag(expense, 7:7) + lag(...
2
votes
1
answer
2k
views
stargazer output several models R
I run three different estimations of panel linear models (fixed effects model with two fixed effect (id and year)).
fixed_YIELD_mean_to_treat.100 <- plm(YIELD_mean_total ~ treated.100 + ...
0
votes
0
answers
244
views
ADD INTERCEPT TO GMM MODEL IN R (function: pgmm; package: plm)
When I launch the pgmm function using the plm package for my dynamic panel data model I can see the output that shows the results for every variable I inserted in the model (including the lags) but I ...
1
vote
1
answer
4k
views
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 ...