我想将pglm回归应用于面板数据:
layer_reg <- pglm(formule, data = df_train[,c(1:2,5:17,41,42,50,51,52,58)], family=binomial(logit), na.action=na.omit, effect = "twoways", model = "within", index = c("reportingMonth","DUNS"))
其中:
formule <- reformulate(setdiff(colnames(df_test)[c(1:2,5:17,41,42,50,51,52,58)], "Ypred"), response="Ypred")
但是,当我运行代码时,出现以下错误:
Error in model.matrix.pFormula(formula, data, rhs = 1, model = "pooling", :
单个索引变量中的不适用
以下是我使用的一些数据:
reportingMonth DUNS currencyCode Monthly.transfered Total.Outstanding notYetIssued issue31_60 issue61_90 issue91_120 issue121_150 issue151_180 issue181_210 issue211_240 issue241_270
1 2014-01-01 1145481 USD 4255.83 31713.99 6145.181 25568.81 0.0000 0.000 0.000 0 0 0 0
2 2014-02-01 1145481 USD 24326.95 30484.09 24326.949 4255.83 1901.3104 0.000 0.000 0 0 0 0
3 2014-03-01 1145481 USD 14483.18 31512.14 14483.181 17028.96 0.0000 0.000 0.000 0 0 0 0
4 2014-04-01 1145481 USD 15010.96 28620.48 15010.961 12213.36 1396.1552 0.000 0.000 0 0 0 0
5 2014-05-01 1145481 USD 28562.30 43776.73 28562.301 13813.08 5.1920 1396.155 0.000 0 0 0 0
6 2014-06-01 1145481 USD 18495.09 46830.59 18495.092 26892.61 46.7368 0.000 1396.155 0 0 0 0
issue271_300 issue301_330 issue331_360 issue361_390 issue391_420 issue421_450 issue451_480 issue481_510 issue511_540 issue541_570 issue571_600 issue601_630 issue631_660 issue661_690
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 0 0 0 0 0 0 0 0 0 0 0 0 0 0
issue691_720 issue721_750 issue751_780 issue781_810 issue811_840 issue841_870 issue871_900 issue901_930 issueMore931 Mother.DUNS countryIsoCode currency.Code insolvency netSales
1 0 0 0 0 0 0 0 0 0 1145481 US USD 0.0019 1082363920
2 0 0 0 0 0 0 0 0 0 1145481 US USD 0.0015 960578080
3 0 0 0 0 0 0 0 0 0 1145481 US USD 0.0015 960578080
4 0 0 0 0 0 0 0 0 0 1145481 US USD 0.0016 960578080
5 0 0 0 0 0 0 0 0 0 1145481 US USD 0.0016 960578080
6 0 0 0 0 0 0 0 0 0 1145481 US USD 0.0016 960578080
netWorth totalAssets currentAssets currentLiabilities countryCode primarySICCode Y comportement diff_insolvency diff_retard TPE PME ETI GE taille Ypred
1 704103840 1644364480 544315200 175907600 US 3724 0 1 0e+00 0 0 0 1 0 3 0
2 1004444320 1868832240 507932480 264279840 US 3724 0 1 -4e-04 0 0 0 1 0 3 0
3 1004444320 1868832240 507932480 264279840 US 3724 0 1 0e+00 0 0 0 1 0 3 0
4 1004444320 1868832240 507932480 264279840 US 3724 0 1 1e-04 0 0 0 1 0 3 0
5 1004444320 1868832240 507932480 264279840 US 3724 0 1 0e+00 0 0 0 1 0 3 0
6 1004444320 1868832240 507932480 264279840 US 3724 0 1 0e+00 0 0 0 1 0 3 0
问题是我的数据索引中没有任何NA,因此我也不知道它的来源...有人有想法吗?谢谢