1. Introducción

Este documento presenta el análisis econométrico del riesgo financiero bancario en Corea del Sur para el periodo 2018-2025. La variable dependiente es el ratio de préstamos morosos (NPL) de los cuatro principales bancos comerciales coreanos: KEB Hana Bank, Kookmin Bank, Shinhan Bank y Woori Bank. Se estima un modelo de datos de panel con efectos fijos individuales y errores estándar robustos de Arellano.

2. Carga de librerías y datos

library(readxl)
library(dplyr)
library(tidyr)
library(zoo)
library(WDI)
library(plm)
library(lmtest)
library(sandwich)
library(ggplot2)

3. Estadísticos descriptivos

summary(datos_final4[, c("npl", "roa", "nim", "bis", "provisions", "lcr",
                          "pib", "inflacion", "tipo_cambio", "deuda_hogares")])
##       npl              roa              nim             bis       
##  Min.   :0.1800   Min.   :0.3500   Min.   :1.330   Min.   :14.38  
##  1st Qu.:0.2575   1st Qu.:0.5400   1st Qu.:1.407   1st Qu.:16.09  
##  Median :0.3100   Median :0.5900   Median :1.500   Median :17.34  
##  Mean   :0.3099   Mean   :0.5842   Mean   :1.520   Mean   :17.05  
##  3rd Qu.:0.3500   3rd Qu.:0.6300   3rd Qu.:1.590   3rd Qu.:17.89  
##  Max.   :0.5200   Max.   :0.7600   Max.   :1.860   Max.   :18.92  
##    provisions          lcr              pib            inflacion     
##  Min.   :0.3600   Min.   : 86.54   Min.   :-0.8371   Min.   :0.4987  
##  1st Qu.:0.4500   1st Qu.: 92.55   1st Qu.: 1.9278   1st Qu.:2.0081  
##  Median :0.4900   Median :101.81   Median : 1.9278   Median :2.3217  
##  Mean   :0.5061   Mean   : 99.52   Mean   : 2.1579   Mean   :2.4000  
##  3rd Qu.:0.5525   3rd Qu.:104.81   3rd Qu.: 2.9203   3rd Qu.:2.6407  
##  Max.   :0.6900   Max.   :112.46   Max.   : 4.7478   Max.   :5.0895  
##   tipo_cambio   deuda_hogares  
##  Min.   :1144   Min.   :140.4  
##  1st Qu.:1177   1st Qu.:158.6  
##  Median :1291   Median :160.3  
##  Mean   :1269   Mean   :158.7  
##  3rd Qu.:1363   3rd Qu.:160.6  
##  Max.   :1363   Max.   :163.3

4. Evolución del NPL por banco

ggplot(datos_final4, aes(x = as.Date(fecha), y = npl, color = banco)) +
  geom_line(linewidth = 1) +
  labs(title = "Evolución del NPL por banco (2018-2025)",
       x = "Trimestre", y = "NPL (%)", color = "Banco") +
  theme_minimal()

5. Variables bancarias: distribución por entidad

datos_largo <- datos_final4 %>%
  select(banco, npl, roa, nim, bis, provisions, lcr) %>%
  pivot_longer(cols = -banco, names_to = "variable", values_to = "valor") %>%
  mutate(variable = factor(variable,
    levels = c("npl", "roa", "nim", "bis", "provisions", "lcr"),
    labels = c("NPL (%)", "ROA (%)", "NIM (%)", "BIS (%)", "Provisions (%)", "LCR (%)")))

ggplot(datos_largo, aes(x = banco, y = valor, fill = banco)) +
  geom_boxplot() +
  facet_wrap(~variable, scales = "free_y") +
  labs(title = "Distribución de variables bancarias por entidad",
       x = "", y = "") +
  theme_minimal() +
  theme(axis.text.x = element_blank(), legend.position = "bottom",
        legend.title = element_blank())

6. Variables macroeconómicas: evolución temporal

datos_macro <- datos_final4 %>%
  distinct(fecha, pib, inflacion, tipo_cambio, deuda_hogares) %>%
  pivot_longer(cols = -fecha, names_to = "variable", values_to = "valor") %>%
  mutate(variable = factor(variable,
    levels = c("pib", "inflacion", "tipo_cambio", "deuda_hogares"),
    labels = c("PIB (%)", "Inflacion (%)", "Tipo de cambio (KRW/USD)", "Deuda hogares (% PIB)")))

ggplot(datos_macro, aes(x = as.Date(fecha), y = valor)) +
  geom_line(color = "steelblue", linewidth = 1) +
  facet_wrap(~variable, scales = "free_y") +
  labs(title = "Evolución de variables macroeconómicas - Corea del Sur (2018-2025)",
       x = "", y = "") +
  theme_minimal() +
  theme(strip.text = element_text(face = "bold"))

7. Modelo de efectos fijos con errores robustos de Arellano

coeftest(modelo_fe4, vcov = vcovHC(modelo_fe4, type = "HC3", method = "arellano"))
## 
## t test of coefficients:
## 
##                  Estimate  Std. Error t value  Pr(>|t|)    
## roa           -0.04812594  0.02420474 -1.9883  0.050636 .  
## nim           -0.38693011  0.09248549 -4.1837 8.088e-05 ***
## bis            0.01483691  0.00254270  5.8351 1.473e-07 ***
## pib           -0.00702416  0.00381821 -1.8396  0.070001 .  
## inflacion      0.00789466  0.00827312  0.9543  0.343192    
## tipo_cambio   -0.00050697  0.00011314 -4.4811 2.781e-05 ***
## deuda_hogares -0.00689285  0.00129611 -5.3181 1.160e-06 ***
## provisions     0.59196860  0.11169375  5.2999 1.245e-06 ***
## lcr            0.00671025  0.00223331  3.0046  0.003672 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

8. Bondad del ajuste

summary(modelo_fe4)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = npl ~ roa + nim + bis + pib + inflacion + tipo_cambio + 
##     deuda_hogares + provisions + lcr, data = datos_panel4, effect = "individual", 
##     model = "within")
## 
## Balanced Panel: n = 4, T = 21, N = 84
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -0.0539997 -0.0199799  0.0010881  0.0190741  0.0723971 
## 
## Coefficients:
##                  Estimate  Std. Error t-value  Pr(>|t|)    
## roa           -0.04812594  0.07518143 -0.6401 0.5241481    
## nim           -0.38693011  0.08465370 -4.5707 2.002e-05 ***
## bis            0.01483691  0.00558752  2.6554 0.0097740 ** 
## pib           -0.00702416  0.00559643 -1.2551 0.2135529    
## inflacion      0.00789466  0.00732426  1.0779 0.2847365    
## tipo_cambio   -0.00050697  0.00012224 -4.1474 9.188e-05 ***
## deuda_hogares -0.00689285  0.00169629 -4.0635 0.0001232 ***
## provisions     0.59196860  0.09580239  6.1791 3.614e-08 ***
## lcr            0.00671025  0.00137843  4.8680 6.590e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    0.46584
## Residual Sum of Squares: 0.070377
## R-Squared:      0.84892
## Adj. R-Squared: 0.82339
## F-statistic: 44.3293 on 9 and 71 DF, p-value: < 2.22e-16

9. Gráfico de coeficientes

coefs <- coeftest(modelo_fe4, vcov = vcovHC(modelo_fe4, type = "HC3", method = "arellano"))

df_coefs <- data.frame(
  variable = rownames(coefs),
  coef     = coefs[, 1],
  se       = coefs[, 2]
) %>%
  mutate(
    lower = coef - 1.96 * se,
    upper = coef + 1.96 * se,
    significativo = ifelse(lower > 0 | upper < 0, "Significativo", "No significativo"),
    variable = factor(variable, levels = rev(variable))
  )

ggplot(df_coefs, aes(x = coef, y = variable, color = significativo)) +
  geom_point(size = 3) +
  geom_errorbarh(aes(xmin = lower, xmax = upper), height = 0.2, linewidth = 0.8) +
  geom_vline(xintercept = 0, linetype = "dashed", color = "black") +
  scale_color_manual(values = c("Significativo" = "steelblue", "No significativo" = "gray60")) +
  labs(title = "Coeficientes estimados con intervalos de confianza al 95%",
       subtitle = "Errores estándar robustos de Arellano",
       x = "Coeficiente estimado", y = "", color = "") +
  theme_minimal() +
  theme(legend.position = "bottom")

10. Tests de diagnóstico

# Heterocedasticidad
bptest(modelo_fe4)
## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_fe4
## BP = 17.724, df = 9, p-value = 0.03852
# Autocorrelacion
pbgtest(modelo_fe4)
## 
##  Breusch-Godfrey/Wooldridge test for serial correlation in panel models
## 
## data:  npl ~ roa + nim + bis + pib + inflacion + tipo_cambio + deuda_hogares +  ...
## chisq = 32.673, df = 21, p-value = 0.04997
## alternative hypothesis: serial correlation in idiosyncratic errors

11. Gráfico de residuos

datos_final4$residuos <- as.numeric(residuals(modelo_fe4))

ggplot(datos_final4, aes(x = as.Date(fecha), y = residuos, color = banco)) +
  geom_line(linewidth = 0.8) +
  geom_hline(yintercept = 0, linetype = "dashed", color = "black") +
  facet_wrap(~banco, ncol = 2) +
  labs(title = "Residuos del modelo por entidad bancaria",
       x = "", y = "Residuo") +
  theme_minimal() +
  theme(legend.position = "none", strip.text = element_text(face = "bold"))