简体   繁体   English

计算面板数据和线性概率的 ROC Model

[英]Calculating ROC for panel data and Linear Probability Model

I have panel data from external assets of 102 countries over ~ 20-40 years, depending on the country.我有来自 102 个国家/地区的外部资产的面板数据,时间超过 20-40 年,具体取决于国家/地区。 I tried predicting the probability for a financial crisis, depending on log(total_liabilities to see whether an increase in foreign investment and other capital positions can help predict a crisis.我尝试根据 log(total_liabilities) 预测金融危机的概率,看看外国投资和其他资本头寸的增加是否有助于预测危机。

plm1 <- plm(crisis ~ log_total_liabilities + lag1_log_tot_lia + lag2_log_tot_lia + lag3_log_tot_lia
                        + factor(year) + factor(country), data = dt2, index=c("year", "country"), model="pooling")
summary(plm1)

I started by estimating a plm model, regressing on my crisis dummy.我开始估计 plm model,回归我的危机虚拟人。 To estimate the predictive ability, I wanted to generate a ROC and AUC value, given the regression为了估计预测能力,我想生成一个 ROC 和 AUC 值,给定回归

# Plot of True Positive Rate Against the False Positive Rate
pred1 <- predict(plm1)
pred2 <- prediction(pred1,as.numeric(plm1$crisis))
plot(performance(pred2,"tpr","fpr"), las=0, main="plm1")

I get errors like:我收到如下错误:

Error: not fitting arguments / variables" (translated from German) or "all arguments/variables need to have the same length" (translated from German).错误:不适合 arguments / 变量”(翻译自德语)或“所有参数/变量需要具有相同的长度”(翻译自德语)。

Another approach to obtaining Roc values would start with When changing pred1 <- predict(plm1, dt2) (dt2 is my data frame, containing also some variables I had not used in the plm1 regression), the error differs: The format of predictions is invalid.另一种获取 Roc 值的方法将从 When changing pred1 <- predict(plm1, dt2) (dt2 是我的数据框,还包含一些我没有在 plm1 回归中使用过的变量)开始,错误不同:预测的格式是无效的。 It couldn't be coerced to a list.它不能被强制列入清单。

Are PLMs simply not made for ROC calculations? PLM 是否根本不是为 ROC 计算而设计的? And if so, how come that the paper attached presents AUROC values for a linear probability model with fixed effects?如果是这样,为什么所附的论文会给出具有固定效应的线性概率 model 的 AUROC 值? (See second last row) And if no, what am I doing wrong? (见倒数第二行)如果不是,我做错了什么?

I attached the screenshot of the paper and my dataset.我附上了论文的截图和我的数据集。

CSV File with datasat CSV 带数据卫星的文件

Screenshot of paper with OLS AUROC value带有OLS AUROC值的论文截图

AUC-ROC only works for only binary classification problems. AUC-ROC 仅适用于二元分类问题。 As you used a fixed effects regression, the predicted values produced after plm1, pred1, is a continuous one.当您使用固定效应回归时,在 plm1 之后产生的预测值 pred1 是连续的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM