Questions tagged [panel-data]

A multidimensional dataset usually describing measurements over time for a specific cohort.

Panel data is a dataset that is focused, multivariate longitudinal data for a set of cross-sectional units such as a family or an individual. Many statistical analysis libraries require the data to be formatted in a certain manner.

854 questions
2
votes
1 answer

Count/plot changes over time for a variable in panel data with R

I'm relatively new to R and got stuck with an actually simple thing. I have panel data and I want to plot or count how many observation units experience a change in a specific variable over time. The data looks the following…
Laura
  • 31
  • 2
2
votes
1 answer

R Extract Log Likelihood from a plm object

I would like to extract the log likelihood from a plm object. It works fine when using the logLik function from the base stats package with either felm from the lfe package or feols from the fixest package, but not with any plm object where the…
Moritz Schwarz
  • 2,019
  • 2
  • 15
  • 33
2
votes
1 answer

Upsampling on pandas panel data

I have data that looks like this date ticker x y 0 2018-01-31 ABC 1 5 1 2019-01-31 ABC 2 6 2 2018-01-31 XYZ 3 7 3 2019-01-31 XYZ 4 8 So it is a panel of yearly observations. I want to upsample…
Will
  • 81
  • 7
2
votes
0 answers

Spatial panel model in R (spml): error with balanced spatial panel data

I looked at many posts on similar issue but didn't find a solution for my case. I have balanced panel data for the CBSAs in the US from 2005-2015, when I ran fixed effects model with the following command, I get reasonable results and the panel is…
Jules A
  • 21
  • 2
2
votes
3 answers

2-way FE model gives "empty model" in R

I am trying to run a 2-way fixed effect model in R, using plm. I am trying to get the treatment effect of an event on municipalities votes on referenda. I would like to run the model with municipality and referenda fixed effects. Each row or unit is…
AntVal
  • 583
  • 3
  • 18
2
votes
1 answer

Pandas Panel Data - Shifting values by two taking into consideration year gaps

I am currently working with a panel data of financial information on pandas, therefore working with different companies across different years. I am trying to generate a column of the $ invested shifted by 2 time periods. Hence, reporting the value…
tigio_33
  • 149
  • 8
2
votes
1 answer

Pandas Panel Data - Returns rolling cumulative sum with year gaps

I am currently working with a panel data of financial information on pandas, and I am trying to generate a column of cumulative abnormal returns for 3-year on a rolling basis. Unfortunately my data is a bit spotty and therefore for the same company…
tigio_33
  • 149
  • 8
2
votes
1 answer

R, add back fitted values plm(), the fitted values are fewer than the observations in the regression

We're doing a panel regression using the plm() function of R package plm and want add the fitted values as a new column to the dataset on which the regression was made. MP_regression <- plm(operating_exp ~ HHI + rate + rate_lag1 + rate_lag2 + …
Karl Wig
  • 55
  • 4
2
votes
1 answer

Use the formula("string") with felm() from the lfe package while also using fixed effects

I'm trying to run a large regression formula that is created somewhere else as a long string. I also want to use "fixed effects" (individual specific intercepts). Without fixed effects this works both in the lm() and in felm()…
Jakob
  • 1,325
  • 15
  • 31
2
votes
0 answers

How to Perform Panel Unit Root Test Using cipstest Function of plm Package and Panel Cointegration Test Using pedroni99m Function of pco Package

I'm trying to calculate two tests on my panel data. However, following the documentations for the various packages and respective functions, I obtain errors. My search online for possible remedies has not being fruitful. First, I want to perform a…
Azaaviela
  • 71
  • 6
2
votes
0 answers

Easiest way to create indicator variables for changes in time series in R

I have a 14 million row dataset of products, tariff rates, trade volumes, and year-month combinations in the following format: df <- as.data.frame(matrix(c(1220, "2013-1", 10011900, 29307, .1, 1220, "2013-2", 10011900, 28202, .1, …
bdk19
  • 21
  • 1
2
votes
1 answer

R: Filtering data in plm

I have a pdata.frame for 14 years x 89 observations and 10 variables + 4 dummies. Those dummies variables are only for filtering (when necessary) my data. When using Stata, I just add an "if VAR==1" at the end of my code. How to use this with plm…
Adilson V Casula
  • 164
  • 1
  • 16
2
votes
1 answer

broom::augment too slow with panel mixed model

I would like to ask, when doing mixed panel data models, and then retriving complete regression output using broom::augment it is very slow as as oppose to different model such as random, fixed effect example: #Load…
Petr
  • 1,606
  • 2
  • 14
  • 39
2
votes
1 answer

Fill Miss Years in Panel Data

I have what I believe is a very simple problem but I have been unable to find any solution to it on the internet. I am trying to clean panel data and I have a dataset where the observations have been recorded in irregular time steps. The entity is…
benalbert342
  • 71
  • 1
  • 4
2
votes
0 answers

Second generation panel unit root test: CIPS TEST

I was trying to conduct a panel unit root test of Pesaran 2007, in the plm package, using cipstest() function. CIPS stands for Crossectionally -augmented IPS(2003) test due to << Im K, Pesaran H, Shin Y. 2003. Testing for unit roots in heterogeneous…
Eyayaw
  • 1,033
  • 5
  • 10