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
-1
votes
1 answer

Visualize a fixed effects regression in R

I have a panel data model with various explanatory variables, but I am mainly interested in the effect of just one of them. I would like to visualize my model by putting all the other explanatory variables at their means and plot my model on a…
7Luke7
  • 15
  • 4
-1
votes
1 answer

treatment effect on unbalanced panel data

enter image description hereI have one unbalanced dataset that contains movie sales data along with some of the characteristics of the movies for several years. One treatment (event) happened in the society in a specific year in between. Now, I want…
Lili.Y
  • 13
  • 3
-1
votes
2 answers

Subset panel data with more than one match for a criteria over multiple columns

I have data over individuals that looks like this: df=data.frame(Col1=c("A","A","B","B"),Col2=c("A50","C50","B60","A70"),Col3=c("A40","A50","A50","A70")) criteria="A50" Col1 Col2 Col3 A A50 A40 A C50 A50 B A50 A50 B A70 …
KGB91
  • 630
  • 2
  • 6
  • 24
-1
votes
1 answer

Calculate average and add as new row to dataframe

I have some panel data in long format from 2009 - 2019 for 100+ countries. df <- structure(list(area_name = c("Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",…
asd7
  • 19
  • 5
-1
votes
2 answers

How to create a numeric index from a string variable?

I'm working with panel data and I am stuck in this situation: What I want is to create a numeric ID (NumID) using Country as a reference, like this: Can someone help me? Many thanks!
-1
votes
1 answer

How do I change my panel data from wide to long and also, how do I create a time variable and add it

I am having some trouble getting my code to work. I earlier asked a question on this website that did not solve my problem entirely. "Reshaping the HRS data from wide to long and creating a time variable" This time I tried to be very clear and…
Emil Krabbe
  • 101
  • 9
-1
votes
3 answers

Aggregating Data by County and Year in R

I have a dataframe that looks like so: year <- year month <- c(1,1,1,1,1,2,2,2,3,3) county <- c("Upshur", "Upshur", "Upshur", "Collin","Collin","Upshur","Upshur", "Collin","Upshur","Collin") citation <- c(1,0,1,1,1,0,1,0,1,1) df <- data.frame(year,…
M. Damon
  • 31
  • 8
-1
votes
2 answers

create panel data in R (cross section dimension holds repeated entities)

I have data that look like the following: >loan data ID loan_start_date loan_maturity_date feb13 march13 april13........ 1 2016-01-03 2017-01-03 46 45 44 1 2011-01-08 …
-1
votes
1 answer

Between R squart

i'm useing the between R^2 to validate the predictive power of my FE model (output -xtreg) . I like to use it for a paper but cant find a source (paper or book) which descrips the logic of between R^2 (just for citation not understanding) Someone…
tryhard
  • 1
  • 2
-1
votes
1 answer

Error in plm function: 'names' attribute [343] must be the same length as the vector [0]

I am running a panel regression using 'plm' function using the following code: test_reg=plm(y~x1+x2+x3+x4*x7+x5*x7+x6*x7+x8+x9+x10+x11,DATA, index = c("year","id"),model ="within") summary(test_reg) Then I get the following error: Error in…
Eric
  • 528
  • 1
  • 8
  • 26
-1
votes
1 answer

forecast time to event survival analysis

I'm currently trying to model the time to event, where there are three different events that might happen. It's for telecommunication data, and I want to predict the expected lifetime of unlocked customers, so customers for who their contract period…
-1
votes
1 answer

Treating binary variables for first difference method to solve autocorrelation issue

I have an autocorrelation problem in my panel data. So I decided to use first difference method so deal with this problem. Most of my independent variables are binary. So if I do the finite difference method over this, I get -1, 0, and 1 instead of…
Eric
  • 528
  • 1
  • 8
  • 26
-1
votes
1 answer

Find duplicates in different rows

I have a data frame such this: Country1 Country2 year A B 1993 A B 1994 A C 1993 A C 1994 B A 1993 B A 1994 B …
oudzi
  • 1
  • 1
-1
votes
1 answer

How to compute growth rate (1- and 3-year horizon) from panel data in R

I've a panel dataset of several banks, each from 1997 to 2015, with annual observations s.t.: CODE COUNTRY YEAR LOANS_NET ...other variables 671405 AT 1997 39028938 671405 AT 1998 …
Dan
  • 21
  • 4
-1
votes
2 answers

Reshaping a dataframe in R

I need some help to re-design the output of a function that comes through an R package. My scope is to reshape a dataframe called output_IMFData in a way that look very similar to the shape of output_imfr. The codes of a MWE reproducing these…
msh855
  • 1,493
  • 1
  • 15
  • 36
1 2 3
56
57