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

Is there a predict function for plm in R?

I have a small N large T panel which I am estimating via plm::plm (panel linear regression model), with fixed effects. Is there any way to get predicted values for a new dataset? (I want to estimate parameters on a subset of my sample, and then use…
Ram Ahluwalia
  • 1,092
  • 1
  • 10
  • 25
19
votes
4 answers

How to process panel data for use in a recurrent neural network (RNN)

I have been doing some research on recurrent neural networks, but I am having trouble understanding if and how they could be used to analyze panel data (meaning cross-sectional data that is captured at different periods in time for several subjects…
user1895076
  • 709
  • 8
  • 19
18
votes
2 answers

Cross-validation for grouped time-series (panel) data

I work with panel data: I observe a number of units (e.g. people) over time; for each unit, I have records for the same fixed time intervals. When splitting the data into train and test sets, we need to make sure that both sets are disjoint and…
18
votes
2 answers

Efficient calculation of var-covar matrix in R

I'm looking for efficiency gains in calculating the (auto)covariance matrix from individual measurements over time t with t, t-1, etc.. In the data matrix, each row represents an individual and each column represents monthly measurements (the…
s_baldur
  • 29,441
  • 4
  • 36
  • 69
14
votes
4 answers

Create lagged variable in unbalanced panel data in R

I'd like to create a variable containing the value of a variable in the previous year within a group. id date value 1 1 1992 4.1 2 1 NA 4.5 3 1 1991 3.3 4 1 1990 5.3 …
Matthew
  • 2,628
  • 1
  • 20
  • 35
13
votes
4 answers

Double clustered standard errors for panel data

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…
Alex
  • 19,533
  • 37
  • 126
  • 195
13
votes
1 answer

plm or lme4 for Random and Fixed Effects model on Panel Data

Can I specify a Random and a Fixed Effects model on Panel Data using lme4? I am redoing Example 14.4 from Wooldridge (2013, p. 494-5) in r. Thanks to this site and this blog post I've manged to do it in the plm package, but I'm curious if I can do…
Eric Fail
  • 8,191
  • 8
  • 72
  • 128
12
votes
1 answer

Test for Multicollinearity in Panel Data R

I am running a panel data regression using the plm package in R and want to control for multicollinearity between the explanatory variables. I know there is the vif() function in the car-package, however as far as I know, it cannot deal with panel…
David
  • 9,216
  • 4
  • 45
  • 78
10
votes
1 answer

Difference in Differences in Python + Pandas

I'm trying to perform a Difference in Differences (with panel data and fixed effects) analysis using Python and Pandas. I have no background in Economics and I'm just trying to filter the data and run the method that I was told to. However, as far…
pceccon
  • 9,379
  • 26
  • 82
  • 158
10
votes
1 answer

How to deal with NA in a panel data regression?

I am trying to predict fitted values over data containing NAs, and based on a model generated by plm. Here's some sample code: require(plm) test.data <- data.frame(id=c(1,1,2,2,3), time=c(1,2,1,2,1), y=c(1,3,5,10,8), x=c(1, NA, 3,4,5)) model <-…
Rodrigo
  • 473
  • 4
  • 14
9
votes
1 answer

module 'pandas' has no attribute 'Panel'

I am getting an error while I am converting dictionary data frames to Panel dataframe panelda = pd.Panel() --------------------------------------------------------------------------- AttributeError Traceback (most recent…
Jijo John
  • 1,368
  • 2
  • 17
  • 31
9
votes
2 answers

Weights with plm package

My data frame looks like something as follows: unique.groups<- letters[1:5] unique_timez<- 1:20 groups<- rep(unique.groups, each=20) my.times<-rep(unique_timez, 5) play.data<- data.frame(groups, my.times, y= rnorm(100), x=rnorm(100), POP= 1:100) I…
Zslice
  • 412
  • 1
  • 5
  • 14
8
votes
3 answers

How to run the predicted probabilities (or average marginal effects) for individuals fixed effects in panel data using R?

These are three different ways to run an individual fixed effect method which gives more or less the same results (see below). My main question is how to get predictive probabilities or average marginal effects using the second model (model_plm) or…
Jack
  • 813
  • 4
  • 17
8
votes
1 answer

Can I use dynlm without any lagged variables?

I am trying to use a dynamic linear regression using dynlm command in R programming since I need to analyze my panel data but I do not want to use panel regression. However, my model specification do not contain any lagged variables at all. Can I…
Eric
  • 528
  • 1
  • 8
  • 26
8
votes
2 answers

How to sample/partition panel data by individuals( preferably with caret library)?

I would like to partition panel data and preserve the panel nature of the data: library(caret) library(mlbench) #example panel data where id is the persons identifier over years data <-…
Googme
  • 914
  • 7
  • 27
1
2 3
56 57