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

Merging Daily and Periodic Data into one Dataframe

I am trying to construct a panel-data data frame which consists of both periodic and 'continous' daily data which should be assigned to each other, so that each row of the new data frame has both, the period, the value for the periodic data and the…
Jan Felix
  • 117
  • 9
3
votes
2 answers

extract fitted values for each group variable in panel data

I have a panel data set with a large number of groups. I calculated fitted values for each group and I would like to combine all fitted values into a new data set. I am looking for a possible shortcut to avoid having to do this manually. The…
TCS
  • 127
  • 1
  • 11
3
votes
1 answer

Higher level cluster standard errors for panel data

I want to estimate the cluster SE of a panel model (first differences) in R, with 100 groups, 6,156 individuals and 15 years. Some of the individuals are repeated (4,201 unique) because they are part of a matched sample obtained with a one-to-one,…
3
votes
1 answer

R plm lag - what is the equivalent to L1.x in Stata?

Using the plm package in R to fit a fixed-effects model, what is the correct syntax to add a lagged variable to the model? Similar to the 'L1.variable' command in Stata. Here is my attempt adding a lagged variable (this is a test model and it might…
M_M
  • 899
  • 8
  • 21
3
votes
1 answer

Recurrent Neural Networks for Panel Data

There are 2 parts to this question. Suppose we are looking at sales S of a product across $> 1000$ stores where a it sells. For each of these 1000 stores we have 24 months recorded data. We want to be able to predict S_t <- f(S_{t-1}). We could…
3
votes
1 answer

How to get the corr(u_i, Xb) for panel data fixed effects regression in R

I am trying to develop a fixed effect regression model for a panel data using the plm package in R. I want to get the correlation between fixed effects and the regressors. Something like the corr(u_i, Xb) that comes in the Stata output. How to get…
brock
  • 181
  • 2
  • 10
3
votes
1 answer

Regression using plm package and twoways effect, when data has NA

So, I'd like to run a regression on a panel data, using two-ways effects, for time and stores. If the panel is perfectly balanced, it works fine, but for some reason, if it's not, the code gets stuck. (see:…
thiagogps
  • 439
  • 4
  • 12
3
votes
3 answers

Converting to long panel data format with pandas

I have a DataFrame where rows represent time and columns represent individuals. I want to turn it into into long panel data format in pandas in an efficient manner, as the DataFames are rather large. I would like to avoid looping. Here is an…
splinter
  • 3,727
  • 8
  • 37
  • 82
3
votes
1 answer

Construct Pandas Panel from 2D structured NumPy array

I have a 2D NumPy array of structs: arr = np.zeros((3,5), [('x',int), ('y',float)]) That is: array([[(0, 0.0), (0, 0.0), (0, 0.0), (0, 0.0), (0, 0.0)], [(0, 0.0), (0, 0.0), (0, 0.0), (0, 0.0), (0, 0.0)], [(0, 0.0), (0, 0.0), (0, 0.0),…
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
3
votes
1 answer

pandas panel data update

I am using panel datastructure in pandas for storing a 3d panel. T=pd.Panel(data=np.zeros((n1,n2,n3)),items=n1_label, major_axis=n2_label, minor_axis=n3_label) Later on, I am trying to update (increment) the values stored at individual locations…
dayum
  • 1,073
  • 15
  • 31
3
votes
3 answers

How to interpolate between values on a dataframe using Python and/or R

I have a dataset that looks like this: Which I imported into a pandas dataframe using pandas.read_csv with the Year and Country column as indexes. What I need to do is change the timestep from every 5 years to annually, and interpolate said…
Olovram
  • 53
  • 1
  • 7
3
votes
0 answers

Clustered Standard Errors in Spatial Panel Linear Models (splm)

I am running spatial panel models (using splm) of census tracts in the U.S. between 1990 and 2010 with neighbor matrices based upon distance or contiguity. But I also want to cluster the standard errors on the city the census tract is within.…
bcrew
  • 63
  • 3
3
votes
1 answer

"the second-step matrix is singular, a general inverse is used"

I try to do gmm modelling with the plm package. I wanna use the Bundell Blond estimator and struggle always with the same two warnings: Warning messages: 1: In pgmm(log(A) ~ lag(log(A), : the first-step matrix is singular, a general inverse is…
user3389108
  • 63
  • 1
  • 7
3
votes
1 answer

computing F statistic with user supplied covariance matrix

see edits below With package plm, I was wondering why the F statistic displayed by summary() does not change once I supply a covariance matrix (for robust standard errors). Consider the following code, I do not get a change in the F statistic as…
Helix123
  • 3,502
  • 2
  • 16
  • 36
3
votes
1 answer

Prediction with plm method

I'm using plm package to estimate a random effects model on panel data. Reading this question about the prediction in plm package gives me some doubts. How exactly it works? I tried 3 alternatives methods and they give different solutions. Why…
dax90
  • 1,088
  • 14
  • 29