panel-data

Panel probit in Python

主宰稳场 提交于 2020-12-26 04:24:06
问题 My dataset ( "prob" ) is an unbalanced panel, looking like: index x1 x2 x3 y (dummy 0/1) (100, Timestamp('2016-01-26 09:10:00')) 19.9 13.44 -0.006 0 (100, Timestamp('2016-01-26 09:15:00')) 17.2 13.25 -0.046 0 (200, Timestamp('2016-01-26 09:20:00')) 19.4 19.06 0.04 1 I would like to estimate a panel probit model in Python (y is my left-hand side variable, x1, x2, x3 are the right-hand side variables). Panel entity shoud be the IDs, which are in the first part of dataframe index (100, 200, etc.

Missing dimensions

懵懂的女人 提交于 2020-06-17 15:53:46
问题 I'm a new R user and I'm trying to use panel data (fixed effects) to analyse the effect that several independent variables have on the log of GNI. I'm using the plm package, and this is my code library(plm) head(project_data) Y = cbind(project_data$log_GNI_PPP) X = cbind(project_data$EU_application, project_data$EU_membership, project_data$distance_from_brussels, project_data$Former_USSR_DUMMY, project_data$natural_resources_pct, project_data$secondary_attendence_prct, project_data$eu

How to run linear regression model for each industry-year excluding firm i observations in R?

白昼怎懂夜的黑 提交于 2020-04-30 06:57:07
问题 Here is the dput output of my dataset in R...... data1<-structure(list(Year = c(1998, 1999, 1999, 2000, 1996, 2001, 1998, 1999, 2002, 1998, 2005, 1998, 1999, 1998, 1997, 1998, 2000), `Firm name` = c("A", "A", "B", "B", "C", "C", "D", "D", "D", "E", "E", "F", "F", "G", "G", "H", "H"), Industry = c("AUTO", "AUTO", "AUTO", "AUTO", "AUTO", "AUTO", "AUTO", "AUTO", "AUTO", "Pharma", "Pharma", "Pharma", "Pharma", "Pharma", "Pharma", "Pharma", "Pharma"), X = c(1, 2, 5, 6, 7, 9, 10, 11, 12, 13, 15, 16

R - Error in class(x) - plm - only within and random effects models

元气小坏坏 提交于 2020-04-18 03:47:46
问题 I have run into some difficulties with the plm function in R. I am trying to run different panel data models on the same dataset and it works with the "between","fd" and "pooling" models, but not with the "within" or "random" models. Not sure what I am doing it wrong. Below is my code and the error message that I get. Would be grateful for any help!! pdata_1<-pdata.frame(mydata_1,index=c("Country","Year")) fd<-plm(Y~Category+Eurozone+Poverty_Rate,data = pdata_1,model = "fd") pooled<-plm(Y

error in plm regression

我们两清 提交于 2020-04-10 16:13:13
问题 colleagues! I have panel data: Company year Beta NI Sales Export Hedge FL QR AT Foreign 1 1 2010 -2.2052800 293000 1881000 78.6816 0 23.5158 1.289 0.6554 3000 2 1 2011 -2.2536069 316000 2647000 81.4885 0 21.7945 1.1787 0.8282 22000 3 1 2012 0.3258693 363000 2987000 82.4908 0 24.5782 1.2428 0.813 -11000 4 1 2013 0.4006030 549000 4546000 79.4325 0 31.4168 0.6038 0.7905 71000 5 1 2014 -0.4508811 348000 5376000 79.2411 0 37.1451 0.6563 0.661 -64000 6 1 2015 0.1494696 355000 5038000 77.1735 0 33

spatial panel regression in R: Error with spgm

落爺英雄遲暮 提交于 2020-01-16 12:37:30
问题 I have one problem with the spatial regression code shown below ( Code Example ). After I run the regression I get the following error Error in listw %*% as.matrix(ywithin) : Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90 When I remove the spatial dimension from the regression, the regression runs perfectly, so I guess the error might be in the spatial weight matrix. Could someone please help me address why this error occurs and recommend a

spatial panel regression in R: Error with spgm

最后都变了- 提交于 2020-01-16 12:37:12
问题 I have one problem with the spatial regression code shown below ( Code Example ). After I run the regression I get the following error Error in listw %*% as.matrix(ywithin) : Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 90 When I remove the spatial dimension from the regression, the regression runs perfectly, so I guess the error might be in the spatial weight matrix. Could someone please help me address why this error occurs and recommend a

Subsetting a unbalanced panel dataset to have at least 2 consecutive observations in R

扶醉桌前 提交于 2020-01-03 17:25:42
问题 I have an unbalanced panel dataset in R. The following will serve as an example: dt <- data.frame(name= rep(c("A", "B", "C"), c(3,2,3)), year=c(2001:2003,2000,2002,2000:2001,2003)) > dt name year 1 A 2001 2 A 2002 3 A 2003 4 B 2000 5 B 2002 6 C 2000 7 C 2001 8 C 2003 Now, I need to have at least 2 consecutive year observations for each name . Hence, I would like to remove row 4, 5, and 8. How do I best do that in R? EDIT: Thanks to the comment below, I can make a bit clearer. If I had an