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
5
votes
2 answers

R sample from unbalanced panel data

I am working with unbalanced panel data from which I would like to draw a random sample that is unbiased by the differing number of observations per unit. For example, in the code below, IBM is two times more likely to be selected than GOOG and…
user1491868
  • 596
  • 4
  • 15
  • 42
5
votes
1 answer

Stata. How to transform a dataset into pure panel data?

I have done this many times with Excel and Java... This time I need to do it using Stata because it is more convenient to preserve variables' labels. How can I restructure dataset_1 into dataset_2 below? I need to transform the following…
CHEBURASHKA
  • 1,623
  • 11
  • 53
  • 85
5
votes
1 answer

Hausman type test in R

I have been using "plm" package of R to do the analysis of panel data. One of the important test in this package for choosing between "fixed effect" or "random effect" model is called Hausman type. A similar test is also available for the Stata. The…
Metrics
  • 15,172
  • 7
  • 54
  • 83
5
votes
1 answer

Fama MacBeth standard errors in R

Does anyone know if there is a package that would run Fama-MacBeth regressions in R and calculate the standard errors? I am aware of the sandwich package and its ability to estimate Newey-West standard errors, as well as providing functions for…
Alex
  • 19,533
  • 37
  • 126
  • 195
4
votes
1 answer

How to Plot the "time" effects results from PLM/ Fixest?

I am running a fixed effects model with a continuous variable (say parental wealth) on another continuous variable (children's wealth). I have a few control variables as well. I want to plot the relationship between X and Y, over "Time". Is it…
NanoBot
  • 837
  • 1
  • 7
  • 10
4
votes
1 answer

How to do granger causality test after panel vector autoregression (pVAR) in R?

How to do granger causality test after running a panel vector autoregression in R (using the panelvar package)? In order to run the panel VAR, one could do the following: library(plm) library(panelvar) set.seed(12345) x = rnorm(240) z = x +…
Miranda
  • 148
  • 13
4
votes
0 answers

SPML (spatial panel models): Error in lag.listw | unbalanced panels

I am making spatial panel models from the splm library but I cannot make a fixed or random effects model because it comes out that it is an unbalanced panel. Data data and shp files Reproducible…
cdcarrion
  • 574
  • 6
  • 22
4
votes
2 answers

Failing to install panelr package

I am failing to read in the panelr package from the library. I used the package utilising its wbm() function on some panel data earlier this year and I have even tried to install it and I get this message: Warning in install.packages : package…
hzhou
  • 55
  • 6
4
votes
0 answers

R: Error in terms.default(formula) : no terms component nor attribute (pgmm function)

I try to learn how to use the GMM method with R (Arellano-Bond estimator). So I use the pgmm command from the package plm. I reproduced the code of this example: https://www.rdocumentation.org/packages/plm/versions/1.6-5/topics/pgmm with these…
J.Martin
  • 41
  • 3
4
votes
2 answers

Statsmodels Mixed Linear Model predictions

I am estimating a Mixed Linear Model using the statsmodels MixedLM package in Python. After fitting the model, I now want to make predictions but am struggling to understand the 'predict' method. The statsmodels documentation…
Roald Schuring
  • 179
  • 1
  • 3
  • 13
4
votes
0 answers

Hausman Test for Logistic Panel Regression Models

I want to do the Hausman test to determine whether random effects specification would be appropriate for my panel data. When I tried to use ph-test for a Logistic Regression model, I got the message Error in UseMethod("phtest"Ω :no applicable…
xiong
  • 41
  • 2
4
votes
1 answer

Residuals from first differenced regression on unbalanced panel

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…
Misophist
  • 55
  • 3
4
votes
2 answers

R Optimal way to create time series from start and end dates for groups

I have a data set where for each group I have a start and an end date. I want to turn this data into one where for each time period (month) I have one row of observation for each group. Here is a sample of input data, groups are identified by…
4
votes
1 answer

Should year variable be factor or numeric in panel data in R?

I have a panel dataset where hospitals are followed over time from 2004 to 2010 every two years. The data is in Stata but I take it to R. Initially the variables year (2004, 2006, 2008, 2010) and t (1=2004, 2=2006 and so on) are in integer but later…
user3571389
  • 335
  • 1
  • 5
  • 10
4
votes
1 answer

View all estimates in plm output in R

I'm trying to run plm to see effects of classes positive, negative and neutral on stock prices. DATE <- c("1","2","3","4","5","6","7","1","2","3","4","5","6","7") COMP <- c("A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B") RET…
cptn
  • 693
  • 2
  • 8
  • 28
1 2
3
56 57