Carga de librerias

library(magrittr)
library(dplyr)
library(readxl)

Importar datos

USEDAT <- read_excel("D:/TESIS/DATA/USEDAT1.xlsx", 
    sheet = "CONS")
USEDAT

Transformación de la data

Tasa del crecimiento del PBI

USEDAT <- USEDAT %>% group_by(region) %>%  mutate(ttpbi= log(pbi)-log(lag(pbi)))
USEDAT <- USEDAT %>%  transform(region= as.factor(region))

Tasa de crecimiento de las exportaciones

USEDAT <- USEDAT %>% group_by(region) %>% mutate(ttexp = log(exp)-log(lag(exp)))

Normalización de indicadores

Capital Humano

Promedio de escolaridad

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(nprom_esco = (prom_esco - min(prom_esco)) / (max(prom_esco) - min(prom_esco)))

Tasa de analfabetismo

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(ntasa_analf = (max(tasa_analf)-tasa_analf) / (max(tasa_analf) - min(tasa_analf)))

Gasto público por alumno en educación superior

USEDAT <- USEDAT %>% 
  group_by(region) %>% 
  mutate(ngasto_alum = ((gasto_alum-min(gasto_alum))/(max(gasto_alum)-min(gasto_alum))))

Niños del cuarto grado con nivel satisfactorio en lectura

USEDAT <- USEDAT %>% 
  group_by(region) %>% 
  mutate(nsati_lec= ((sati_lec-min(sati_lec))/(max(sati_lec)-min(sati_lec))))

Niños del cuarto grado con nivel satisfactorio en razonamiento

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(nsati_mat = (sati_mat - min(sati_mat)) / (max(sati_mat) - min(sati_mat)))

Poblacióm que reportó padecer algún problema de salud crónico

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(ntasa_morbi= (max(tasa_morbi)-tasa_morbi) / (max(tasa_morbi) - min(tasa_morbi)))

Seguridad y orden público

Tasa de homicidios

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(ntas_hom = (max(tas_hom) - tas_hom) / (max(tas_hom) - min(tas_hom)))

Tasa de faltas

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(ntasa_faltas = (max(tasa_faltas) - tasa_faltas) / (max(tasa_faltas) - min(tasa_faltas)))

Tasa de delitos

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(ntasa_delit = (max(tasa_delit) - tasa_delit) / (max(tasa_delit) - min(tasa_delit)))

Población victima de algun evento contra tu salud

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(npob_vic = (max(pob_vic) - pob_vic) / (max(pob_vic) - min(pob_vic)))

Cohesión social

Opinión favorable de la población sobre la gestión del gobierno central

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(nges_cen = (ges_cen - min(ges_cen)) / (max(ges_cen) - min(ges_cen)))

Opinión favorable de la población sobre la gestión del gobierno regional

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(nges_reg = (ges_reg - min(ges_reg)) / (max(ges_reg) - min(ges_reg)))

Opinión favorable de la población sobre la gestión del gobierno local

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(nges_loc = (ges_loc - min(ges_loc)) / (max(ges_loc) - min(ges_loc)))

Conflictos sociales

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(nconfli = (max(confli) - confli) / (max(confli) - min(confli)))

Equidad e inclusión social

Niveles de pobreza monetaria

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(npob_monet = (max(pob_monet) - pob_monet) / (max(pob_monet) - min(pob_monet)))

Población con al menos una necesidad insatisfecha

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(npob_nec = (max(pob_nec) - pob_nec) / (max(pob_nec) - min(pob_nec)))

Tasa de empleo informal

USEDAT <- USEDAT %>%
  group_by(region) %>%
  mutate(ntasa_inf = (max(tasa_inf) - tasa_inf) / (max(tasa_inf) - min(tasa_inf)))

Creación de indicadores

Indicador capital humano

USEDAT <- USEDAT  %>% 
  group_by(region) %>% 
  mutate(ind_cap = (((1/6)*nprom_esco)+((1/6)*ntasa_analf)+((1/6)*ngasto_alum)+((1/6)*nsati_lec)+((1/6)*nsati_mat)+((1/6)*ntasa_morbi)))

Seguridad y orden público

USEDAT <- USEDAT %>% 
  group_by(region) %>% 
  mutate(ind_segu = ((0.25*ntas_hom) + (0.25*ntasa_faltas) + (0.25*ntasa_delit) + (0.25*npob_vic)))

Cohesión social

USEDAT <- USEDAT %>% 
  group_by(region) %>% 
  mutate(ind_cohes = ((0.25*nges_cen) + (0.25*nges_reg) + (0.25*nges_loc) + (0.25*nconfli)))

Equidad e inclusión social

USEDAT <- USEDAT %>% 
  group_by(region) %>% 
  mutate(ind_equi = (((1/3)*npob_monet) + ((1/3)*npob_nec) + ((1/3)*ntasa_inf)))

Indicador de bienestar social

USEDAT <- USEDAT %>% 
  group_by(region) %>% 
  mutate(IRBS = ((0.25*ind_cap) + (0.25*ind_segu) + (0.25*ind_cohes) + (0.25*ind_equi)))

Datasat Normalizado

NUSEDAT <- USEDAT[,c(1,2, 22:45,19,21,20)]

Hechos Estilizados

Correlación

library(DataExplorer)
## Warning: package 'DataExplorer' was built under R version 4.4.1
plot_correlation(NUSEDAT[,c(22:26)])

Evolución de las exportaciones

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.4.3
ggplot(NUSEDAT, aes(x= year, y= ttexp))+
  geom_line()+
  facet_wrap(~region)+
  labs(title = "Evolución de las exportaciones", x= "Año", y= "Valor FOB (VAR %)" ) +
  scale_x_continuous(breaks = seq(200,2025, by=6))+
  theme(axis.text.x = element_text(size = 5))
## Warning: Removed 26 rows containing missing values or values outside the scale range
## (`geom_line()`).

Región con mayor exportaciones

NUSEDAT %>% 
  group_by(region) %>% 
  summarise(top_exp= mean(ttexp*100, na.rm= TRUE)) %>% 
  slice_max(top_exp, n= 5)

Región con menor exportaciones

NUSEDAT %>% 
  group_by(region) %>% 
  summarise(top_exp= mean(ttexp*100, na.rm= TRUE)) %>% 
  slice_min(top_exp, n=5)

Evolución del PBI

library(ggplot2)
ggplot(NUSEDAT, aes(x= year, y= ttpbi))+
  geom_line()+
  facet_wrap(~region)+
  labs(title = "Evolución del PBI", x= "Año")+
  scale_x_continuous(breaks = seq(200,2025, by=6))+
  theme(axis.text.x = element_text(size = 5))
## Warning: Removed 26 rows containing missing values or values outside the scale range
## (`geom_line()`).

Región con el pbi más alto

NUSEDAT %>% 
  group_by(region) %>% 
  summarise(top_pbi= mean(ttpbi*100, na.rm= TRUE)) %>% 
  slice_max(top_pbi, n= 5)

Región con el pbi más bajo

NUSEDAT %>% 
  group_by(region) %>% 
  summarise(top_pbi= mean(ttpbi*100, na.rm= TRUE)) %>% 
  slice_min(top_pbi, n=5)

Evolución del indicador de bienestar

library(ggplot2)
ggplot(NUSEDAT, aes(x=year, y= IRBS*100))+
  geom_line()+
  facet_wrap(~region)+
  labs(title = "Evolución del Índice de Bienestar Social", x= "Año", y="IRBS")+
  scale_x_continuous(breaks = seq(2000,2024,6))+
  theme(axis.text.x = element_text(size = 7))

Región con el índice de bienestar más alto

NUSEDAT %>% 
  group_by(region) %>% 
  summarise(top_IRBS= mean(IRBS)*100) %>% 
  slice_max(top_IRBS, n= 5)

Región con el índice de bienestar más bajo

NUSEDAT %>% 
  group_by(region) %>% 
  summarise(top_IRBS= mean(IRBS)*100) %>% 
  slice_min(top_IRBS, n=5)

Evolución del capital humano

library(ggplot2)

ggplot(NUSEDAT, aes(x = year, y = ind_cap*100)) +
  geom_line(show.legend = FALSE) +
  facet_wrap(~region) +
  labs(title = "Evolución del pilar capital humano",
       x = "Año",
       y = "Pilar: Capital Humano")+
  theme(axis.text.x = element_text(size= 7))+
  scale_x_continuous(breaks = seq(2000,2024,6))

Regiones con el indicador de capital humano más alto

NUSEDAT %>% 
  group_by(region) %>%
  summarise(top_ind_cap = mean(ind_cap)*100) %>% 
  slice_max(top_ind_cap,n=5)

Regiones con el indicador de capital humano más bajo

NUSEDAT %>% 
  group_by(region) %>%
  summarise(top_ind_cap = mean(ind_cap)*100) %>% 
  top_n(-5,top_ind_cap)

Evolución de la seguridad y orden interno

library(ggplot2)
ggplot(NUSEDAT, aes(x = year, y = ind_segu*100)) +
  geom_line(show.legend = FALSE) +
  facet_wrap(~region) +
  labs(title = "Evolución del pilar seguridad y orden interno por regiones",
       x = "Año",
       y = "Pilar: Seguridad y orden interno")+
  theme(axis.text.x = element_text(size = 7))+
  scale_x_continuous(breaks = seq(2000,2024, 6))

Regiones con el indicador seguridad y orden interno más alto

NUSEDAT %>% 
  group_by(region) %>%
  summarise(top_ind_segu = mean(ind_segu)*100) %>% 
  slice_max(top_ind_segu, n=5)

Regiones con el indicador seguridad y orden interno más bajo

NUSEDAT %>% 
  group_by(region) %>%
  summarise(top_ind_segu = mean(ind_segu)*100) %>% 
  slice_min(top_ind_segu, n= 5)

Evolución de la cohesión social

ggplot(NUSEDAT, aes(x=year, y=ind_cohes*100))+
  geom_line()+
  facet_wrap(~region)+
  labs(title = "Evolución del pilar cohesión social",
       x = "Año",
       y = "Pilar: COhesión social")+
  scale_x_continuous(breaks = seq(2000, 2025, by = 6))+
   theme(axis.text.x = element_text(size = 7))

Regiones con el indicador cohesión social más alto

NUSEDAT %>% 
  group_by(region) %>%
  summarise(top_ind_cohes = mean(ind_cohes)*100) %>% 
  slice_max(top_ind_cohes, n=5)

Regiones con el indicador cohesión social más bajo

NUSEDAT %>% 
  group_by(region) %>%
  summarise(top_ind_cohes = mean(ind_cohes)*100) %>% 
  slice_min(top_ind_cohes, n=5)

Evolución de la equidad e inclusión social

library(ggplot2)

ggplot(NUSEDAT, aes(x = year, y = ind_equi)) +
  geom_line(show.legend = FALSE) +
  facet_wrap(~region) +
  labs(title = "Evolución del pilar equidad e inclusión social",
       x = "Año",
       y = "Pilar: Equidad e Inclusión Social")+
   scale_x_continuous(breaks = seq(2000, 2025, by = 6))+
  theme(axis.text.x = element_text(size = 7))

Regiones con el indicador equidad e inclusión social más alto

NUSEDAT %>% 
  group_by(region) %>%
  summarise(top_ind_equi = mean(ind_equi)*100) %>% 
  slice_max(top_ind_equi, n=5)

Regiones con el indicador equidad e inclusión social más bajo

NUSEDAT %>% 
  group_by(region) %>%
  summarise(top_ind_equi = mean(ind_equi*100)) %>% 
  slice_min(top_ind_equi, n=5)

Modelos aplicados

MCO

MCO por pilares

attach(NUSEDAT)
summary(lm(log(pbi)~ ind_cap+ind_cohes+ind_equi+ind_segu+log(exp)))
## 
## Call:
## lm(formula = log(pbi) ~ ind_cap + ind_cohes + ind_equi + ind_segu + 
##     log(exp))
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.57874 -0.57375 -0.08777  0.26650  2.41850 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 12.04656    0.29156  41.317  < 2e-16 ***
## ind_cap      0.08256    0.35591   0.232  0.81663    
## ind_cohes    0.55219    0.18820   2.934  0.00346 ** 
## ind_equi     0.69008    0.21057   3.277  0.00110 ** 
## ind_segu    -0.51475    0.25026  -2.057  0.04010 *  
## log(exp)     0.50873    0.01625  31.297  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.778 on 644 degrees of freedom
## Multiple R-squared:  0.6311, Adjusted R-squared:  0.6282 
## F-statistic: 220.3 on 5 and 644 DF,  p-value: < 2.2e-16

MCO indicador de bienestar

summary(lm(log(pbi)~IRBS+log(exp)))
## 
## Call:
## lm(formula = log(pbi) ~ IRBS + log(exp))
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.4182 -0.5972 -0.1045  0.2753  2.2668 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 11.84122    0.25280  46.840  < 2e-16 ***
## IRBS         1.06510    0.41020   2.597  0.00963 ** 
## log(exp)     0.51755    0.01587  32.617  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.785 on 647 degrees of freedom
## Multiple R-squared:  0.6226, Adjusted R-squared:  0.6214 
## F-statistic: 533.7 on 2 and 647 DF,  p-value: < 2.2e-16

Modelos por región

summary(lm(log(pbi) ~ factor(region) - 1 +
         ind_cap:factor(region) +
         ind_cohes:factor(region) +
         ind_equi:factor(region) +
         ind_segu:factor(region)))
## 
## Call:
## lm(formula = log(pbi) ~ factor(region) - 1 + ind_cap:factor(region) + 
##     ind_cohes:factor(region) + ind_equi:factor(region) + ind_segu:factor(region))
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.46296 -0.04244  0.00796  0.04763  0.53790 
## 
## Coefficients:
##                                                 Estimate Std. Error t value
## factor(region)AMAZONAS                         14.478173   0.168009  86.175
## factor(region)ÁNCASH                           16.679943   0.198350  84.093
## factor(region)APURÍMAC                         14.342267   0.233880  61.323
## factor(region)AREQUIPA                         16.794377   0.200795  83.640
## factor(region)AYACUCHO                         14.721301   0.220660  66.715
## factor(region)CAJAMARCA                        15.977729   0.225826  70.752
## factor(region)CUSCO                            16.352373   0.162530 100.611
## factor(region)HUANCAVELICA                     14.863434   0.178057  83.475
## factor(region)HUÁNUCO                          15.165490   0.213858  70.914
## factor(region)ICA                              16.758247   0.279385  59.983
## factor(region)JUNÍN                            16.248484   0.225762  71.972
## factor(region)LA LIBERTAD                      16.445973   0.138720 118.555
## factor(region)LAMBAYEQUE                       15.904542   0.282921  56.216
## factor(region)LIMA METROPOLITANA               18.955334   0.318906  59.439
## factor(region)LIMA PROVINCIAS                  18.979676   0.174299 108.891
## factor(region)LORETO                           15.847891   0.135733 116.757
## factor(region)MADRE DE DIOS                    14.646574   0.207982  70.422
## factor(region)MOQUEGUA                         16.345450   0.166964  97.898
## factor(region)PASCO                            15.585061   0.246370  63.259
## factor(region)PIURA                            16.388904   0.198995  82.359
## factor(region)PROV. CONS. DEL CALLAO           18.531150   0.226136  81.947
## factor(region)PUNO                             15.357061   0.318001  48.293
## factor(region)SAN MARTÍN                       14.661109   0.181514  80.771
## factor(region)TACNA                            15.559511   0.251367  61.899
## factor(region)TUMBES                           14.054576   0.210473  66.776
## factor(region)UCAYALI                          15.023670   0.237066  63.373
## factor(region)AMAZONAS:ind_cap                  0.377046   0.248055   1.520
## factor(region)ÁNCASH:ind_cap                    0.165987   0.345332   0.481
## factor(region)APURÍMAC:ind_cap                  0.623508   0.278325   2.240
## factor(region)AREQUIPA:ind_cap                  0.845234   0.354165   2.387
## factor(region)AYACUCHO:ind_cap                  0.200712   0.272636   0.736
## factor(region)CAJAMARCA:ind_cap                -0.151130   0.342336  -0.441
## factor(region)CUSCO:ind_cap                     0.091816   0.237137   0.387
## factor(region)HUANCAVELICA:ind_cap             -0.039421   0.278436  -0.142
## factor(region)HUÁNUCO:ind_cap                   0.582673   0.256910   2.268
## factor(region)ICA:ind_cap                      -0.230795   0.268924  -0.858
## factor(region)JUNÍN:ind_cap                     0.742750   0.356287   2.085
## factor(region)LA LIBERTAD:ind_cap              -0.124917   0.373851  -0.334
## factor(region)LAMBAYEQUE:ind_cap                0.675044   0.277762   2.430
## factor(region)LIMA METROPOLITANA:ind_cap        0.242108   0.290297   0.834
## factor(region)LIMA PROVINCIAS:ind_cap           0.314170   0.233200   1.347
## factor(region)LORETO:ind_cap                   -0.051713   0.218459  -0.237
## factor(region)MADRE DE DIOS:ind_cap             0.125441   0.247093   0.508
## factor(region)MOQUEGUA:ind_cap                 -0.282543   0.280614  -1.007
## factor(region)PASCO:ind_cap                    -0.171689   0.307162  -0.559
## factor(region)PIURA:ind_cap                     0.306325   0.239356   1.280
## factor(region)PROV. CONS. DEL CALLAO:ind_cap    0.327881   0.305447   1.073
## factor(region)PUNO:ind_cap                      0.582748   0.351588   1.657
## factor(region)SAN MARTÍN:ind_cap                0.448764   0.294060   1.526
## factor(region)TACNA:ind_cap                     0.229799   0.274452   0.837
## factor(region)TUMBES:ind_cap                    0.278849   0.232503   1.199
## factor(region)UCAYALI:ind_cap                  -0.012691   0.270468  -0.047
## factor(region)AMAZONAS:ind_cohes                0.026859   0.132914   0.202
## factor(region)ÁNCASH:ind_cohes                 -0.252321   0.148670  -1.697
## factor(region)APURÍMAC:ind_cohes               -1.310919   0.165347  -7.928
## factor(region)AREQUIPA:ind_cohes               -0.359911   0.179185  -2.009
## factor(region)AYACUCHO:ind_cohes               -0.041356   0.172579  -0.240
## factor(region)CAJAMARCA:ind_cohes              -0.080116   0.135375  -0.592
## factor(region)CUSCO:ind_cohes                  -0.115198   0.151417  -0.761
## factor(region)HUANCAVELICA:ind_cohes           -0.197841   0.134209  -1.474
## factor(region)HUÁNUCO:ind_cohes                -0.483721   0.142344  -3.398
## factor(region)ICA:ind_cohes                    -0.416086   0.140017  -2.972
## factor(region)JUNÍN:ind_cohes                  -0.641556   0.179994  -3.564
## factor(region)LA LIBERTAD:ind_cohes            -0.185899   0.137859  -1.348
## factor(region)LAMBAYEQUE:ind_cohes             -0.420851   0.184479  -2.281
## factor(region)LIMA METROPOLITANA:ind_cohes     -0.382805   0.170773  -2.242
## factor(region)LIMA PROVINCIAS:ind_cohes        -0.513100   0.139972  -3.666
## factor(region)LORETO:ind_cohes                 -0.147487   0.097386  -1.514
## factor(region)MADRE DE DIOS:ind_cohes           0.180251   0.143689   1.254
## factor(region)MOQUEGUA:ind_cohes               -0.563522   0.136565  -4.126
## factor(region)PASCO:ind_cohes                  -0.135585   0.161016  -0.842
## factor(region)PIURA:ind_cohes                  -0.334920   0.147472  -2.271
## factor(region)PROV. CONS. DEL CALLAO:ind_cohes -0.201774   0.148718  -1.357
## factor(region)PUNO:ind_cohes                   -0.072528   0.202942  -0.357
## factor(region)SAN MARTÍN:ind_cohes             -0.187711   0.112364  -1.671
## factor(region)TACNA:ind_cohes                  -0.594588   0.136121  -4.368
## factor(region)TUMBES:ind_cohes                 -0.250408   0.145027  -1.727
## factor(region)UCAYALI:ind_cohes                -0.201573   0.149271  -1.350
## factor(region)AMAZONAS:ind_equi                 0.471799   0.148381   3.180
## factor(region)ÁNCASH:ind_equi                   0.002896   0.171012   0.017
## factor(region)APURÍMAC:ind_equi                 0.854453   0.187171   4.565
## factor(region)AREQUIPA:ind_equi                -0.024965   0.181808  -0.137
## factor(region)AYACUCHO:ind_equi                 0.714289   0.243424   2.934
## factor(region)CAJAMARCA:ind_equi                0.425453   0.258257   1.647
## factor(region)CUSCO:ind_equi                    0.651214   0.155937   4.176
## factor(region)HUANCAVELICA:ind_equi             0.306314   0.152945   2.003
## factor(region)HUÁNUCO:ind_equi                  0.131545   0.173043   0.760
## factor(region)ICA:ind_equi                      0.634529   0.166208   3.818
## factor(region)JUNÍN:ind_equi                    0.001950   0.258992   0.008
## factor(region)LA LIBERTAD:ind_equi              0.392136   0.190576   2.058
## factor(region)LAMBAYEQUE:ind_equi               0.054371   0.214724   0.253
## factor(region)LIMA METROPOLITANA:ind_equi       0.303974   0.126201   2.409
## factor(region)LIMA PROVINCIAS:ind_equi          0.220199   0.166660   1.321
## factor(region)LORETO:ind_equi                   0.211623   0.103897   2.037
## factor(region)MADRE DE DIOS:ind_equi            0.050081   0.137583   0.364
## factor(region)MOQUEGUA:ind_equi                -0.127725   0.138039  -0.925
## factor(region)PASCO:ind_equi                   -0.017880   0.186289  -0.096
## factor(region)PIURA:ind_equi                    0.373763   0.137204   2.724
## factor(region)PROV. CONS. DEL CALLAO:ind_equi   0.434549   0.210719   2.062
## factor(region)PUNO:ind_equi                     0.404501   0.203407   1.989
## factor(region)SAN MARTÍN:ind_equi               0.712451   0.132845   5.363
## factor(region)TACNA:ind_equi                   -0.056284   0.143062  -0.393
## factor(region)TUMBES:ind_equi                   0.472443   0.123267   3.833
## factor(region)UCAYALI:ind_equi                  0.382203   0.094123   4.061
## factor(region)AMAZONAS:ind_segu                -0.271900   0.219011  -1.241
## factor(region)ÁNCASH:ind_segu                   0.116852   0.181424   0.644
## factor(region)APURÍMAC:ind_segu                 0.869343   0.272797   3.187
## factor(region)AREQUIPA:ind_segu                -0.157755   0.271219  -0.582
## factor(region)AYACUCHO:ind_segu                 0.206509   0.174014   1.187
## factor(region)CAJAMARCA:ind_segu                0.094497   0.332708   0.284
## factor(region)CUSCO:ind_segu                   -0.123434   0.180723  -0.683
## factor(region)HUANCAVELICA:ind_segu             0.038413   0.188881   0.203
## factor(region)HUÁNUCO:ind_segu                  0.075491   0.268305   0.281
## factor(region)ICA:ind_segu                     -0.505464   0.259282  -1.949
## factor(region)JUNÍN:ind_segu                   -0.102849   0.200659  -0.513
## factor(region)LA LIBERTAD:ind_segu              0.368474   0.203799   1.808
## factor(region)LAMBAYEQUE:ind_segu               0.061524   0.308250   0.200
## factor(region)LIMA METROPOLITANA:ind_segu       0.019658   0.214882   0.091
## factor(region)LIMA PROVINCIAS:ind_segu          0.142997   0.257612   0.555
## factor(region)LORETO:ind_segu                   0.099720   0.216587   0.460
## factor(region)MADRE DE DIOS:ind_segu           -0.544393   0.188542  -2.887
## factor(region)MOQUEGUA:ind_segu                 0.255123   0.162167   1.573
## factor(region)PASCO:ind_segu                    0.037510   0.190495   0.197
## factor(region)PIURA:ind_segu                    0.042363   0.211029   0.201
## factor(region)PROV. CONS. DEL CALLAO:ind_segu   0.380187   0.257879   1.474
## factor(region)PUNO:ind_segu                     0.027286   0.215014   0.127
## factor(region)SAN MARTÍN:ind_segu               0.303459   0.214408   1.415
## factor(region)TACNA:ind_segu                    0.582293   0.213818   2.723
## factor(region)TUMBES:ind_segu                   0.499258   0.167760   2.976
## factor(region)UCAYALI:ind_segu                  0.071040   0.233765   0.304
##                                                Pr(>|t|)    
## factor(region)AMAZONAS                          < 2e-16 ***
## factor(region)ÁNCASH                            < 2e-16 ***
## factor(region)APURÍMAC                          < 2e-16 ***
## factor(region)AREQUIPA                          < 2e-16 ***
## factor(region)AYACUCHO                          < 2e-16 ***
## factor(region)CAJAMARCA                         < 2e-16 ***
## factor(region)CUSCO                             < 2e-16 ***
## factor(region)HUANCAVELICA                      < 2e-16 ***
## factor(region)HUÁNUCO                           < 2e-16 ***
## factor(region)ICA                               < 2e-16 ***
## factor(region)JUNÍN                             < 2e-16 ***
## factor(region)LA LIBERTAD                       < 2e-16 ***
## factor(region)LAMBAYEQUE                        < 2e-16 ***
## factor(region)LIMA METROPOLITANA                < 2e-16 ***
## factor(region)LIMA PROVINCIAS                   < 2e-16 ***
## factor(region)LORETO                            < 2e-16 ***
## factor(region)MADRE DE DIOS                     < 2e-16 ***
## factor(region)MOQUEGUA                          < 2e-16 ***
## factor(region)PASCO                             < 2e-16 ***
## factor(region)PIURA                             < 2e-16 ***
## factor(region)PROV. CONS. DEL CALLAO            < 2e-16 ***
## factor(region)PUNO                              < 2e-16 ***
## factor(region)SAN MARTÍN                        < 2e-16 ***
## factor(region)TACNA                             < 2e-16 ***
## factor(region)TUMBES                            < 2e-16 ***
## factor(region)UCAYALI                           < 2e-16 ***
## factor(region)AMAZONAS:ind_cap                 0.129116    
## factor(region)ÁNCASH:ind_cap                   0.630960    
## factor(region)APURÍMAC:ind_cap                 0.025499 *  
## factor(region)AREQUIPA:ind_cap                 0.017364 *  
## factor(region)AYACUCHO:ind_cap                 0.461948    
## factor(region)CAJAMARCA:ind_cap                0.659058    
## factor(region)CUSCO:ind_cap                    0.698776    
## factor(region)HUANCAVELICA:ind_cap             0.887467    
## factor(region)HUÁNUCO:ind_cap                  0.023738 *  
## factor(region)ICA:ind_cap                      0.391168    
## factor(region)JUNÍN:ind_cap                    0.037584 *  
## factor(region)LA LIBERTAD:ind_cap              0.738411    
## factor(region)LAMBAYEQUE:ind_cap               0.015424 *  
## factor(region)LIMA METROPOLITANA:ind_cap       0.404663    
## factor(region)LIMA PROVINCIAS:ind_cap          0.178498    
## factor(region)LORETO:ind_cap                   0.812969    
## factor(region)MADRE DE DIOS:ind_cap            0.611901    
## factor(region)MOQUEGUA:ind_cap                 0.314464    
## factor(region)PASCO:ind_cap                    0.576434    
## factor(region)PIURA:ind_cap                    0.201191    
## factor(region)PROV. CONS. DEL CALLAO:ind_cap   0.283570    
## factor(region)PUNO:ind_cap                     0.098027 .  
## factor(region)SAN MARTÍN:ind_cap               0.127594    
## factor(region)TACNA:ind_cap                    0.402808    
## factor(region)TUMBES:ind_cap                   0.230943    
## factor(region)UCAYALI:ind_cap                  0.962593    
## factor(region)AMAZONAS:ind_cohes               0.839932    
## factor(region)ÁNCASH:ind_cohes                 0.090260 .  
## factor(region)APURÍMAC:ind_cohes               1.37e-14 ***
## factor(region)AREQUIPA:ind_cohes               0.045097 *  
## factor(region)AYACUCHO:ind_cohes               0.810706    
## factor(region)CAJAMARCA:ind_cohes              0.554238    
## factor(region)CUSCO:ind_cohes                  0.447120    
## factor(region)HUANCAVELICA:ind_cohes           0.141055    
## factor(region)HUÁNUCO:ind_cohes                0.000730 ***
## factor(region)ICA:ind_cohes                    0.003099 ** 
## factor(region)JUNÍN:ind_cohes                  0.000398 ***
## factor(region)LA LIBERTAD:ind_cohes            0.178093    
## factor(region)LAMBAYEQUE:ind_cohes             0.022934 *  
## factor(region)LIMA METROPOLITANA:ind_cohes     0.025408 *  
## factor(region)LIMA PROVINCIAS:ind_cohes        0.000272 ***
## factor(region)LORETO:ind_cohes                 0.130518    
## factor(region)MADRE DE DIOS:ind_cohes          0.210242    
## factor(region)MOQUEGUA:ind_cohes               4.29e-05 ***
## factor(region)PASCO:ind_cohes                  0.400142    
## factor(region)PIURA:ind_cohes                  0.023550 *  
## factor(region)PROV. CONS. DEL CALLAO:ind_cohes 0.175449    
## factor(region)PUNO:ind_cohes                   0.720952    
## factor(region)SAN MARTÍN:ind_cohes             0.095409 .  
## factor(region)TACNA:ind_cohes                  1.51e-05 ***
## factor(region)TUMBES:ind_cohes                 0.084828 .  
## factor(region)UCAYALI:ind_cohes                0.177481    
## factor(region)AMAZONAS:ind_equi                0.001562 ** 
## factor(region)ÁNCASH:ind_equi                  0.986493    
## factor(region)APURÍMAC:ind_equi                6.24e-06 ***
## factor(region)AREQUIPA:ind_equi                0.890836    
## factor(region)AYACUCHO:ind_equi                0.003490 ** 
## factor(region)CAJAMARCA:ind_equi               0.100079    
## factor(region)CUSCO:ind_equi                   3.48e-05 ***
## factor(region)HUANCAVELICA:ind_equi            0.045720 *  
## factor(region)HUÁNUCO:ind_equi                 0.447488    
## factor(region)ICA:ind_equi                     0.000151 ***
## factor(region)JUNÍN:ind_equi                   0.993995    
## factor(region)LA LIBERTAD:ind_equi             0.040123 *  
## factor(region)LAMBAYEQUE:ind_equi              0.800204    
## factor(region)LIMA METROPOLITANA:ind_equi      0.016359 *  
## factor(region)LIMA PROVINCIAS:ind_equi         0.186999    
## factor(region)LORETO:ind_equi                  0.042171 *  
## factor(region)MADRE DE DIOS:ind_equi           0.716001    
## factor(region)MOQUEGUA:ind_equi                0.355247    
## factor(region)PASCO:ind_equi                   0.923573    
## factor(region)PIURA:ind_equi                   0.006664 ** 
## factor(region)PROV. CONS. DEL CALLAO:ind_equi  0.039683 *  
## factor(region)PUNO:ind_equi                    0.047266 *  
## factor(region)SAN MARTÍN:ind_equi              1.23e-07 ***
## factor(region)TACNA:ind_equi                   0.694167    
## factor(region)TUMBES:ind_equi                  0.000142 ***
## factor(region)UCAYALI:ind_equi                 5.65e-05 ***
## factor(region)AMAZONAS:ind_segu                0.214985    
## factor(region)ÁNCASH:ind_segu                  0.519806    
## factor(region)APURÍMAC:ind_segu                0.001525 ** 
## factor(region)AREQUIPA:ind_segu                0.561054    
## factor(region)AYACUCHO:ind_segu                0.235873    
## factor(region)CAJAMARCA:ind_segu               0.776506    
## factor(region)CUSCO:ind_segu                   0.494910    
## factor(region)HUANCAVELICA:ind_segu            0.838925    
## factor(region)HUÁNUCO:ind_segu                 0.778545    
## factor(region)ICA:ind_segu                     0.051776 .  
## factor(region)JUNÍN:ind_segu                   0.608478    
## factor(region)LA LIBERTAD:ind_segu             0.071180 .  
## factor(region)LAMBAYEQUE:ind_segu              0.841879    
## factor(region)LIMA METROPOLITANA:ind_segu      0.927145    
## factor(region)LIMA PROVINCIAS:ind_segu         0.579076    
## factor(region)LORETO:ind_segu                  0.645412    
## factor(region)MADRE DE DIOS:ind_segu           0.004046 ** 
## factor(region)MOQUEGUA:ind_segu                0.116279    
## factor(region)PASCO:ind_segu                   0.843977    
## factor(region)PIURA:ind_segu                   0.840975    
## factor(region)PROV. CONS. DEL CALLAO:ind_segu  0.141010    
## factor(region)PUNO:ind_segu                    0.899067    
## factor(region)SAN MARTÍN:ind_segu              0.157569    
## factor(region)TACNA:ind_segu                   0.006680 ** 
## factor(region)TUMBES:ind_segu                  0.003056 ** 
## factor(region)UCAYALI:ind_segu                 0.761330    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.09771 on 520 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:      1 
## F-statistic: 1.372e+05 on 130 and 520 DF,  p-value: < 2.2e-16

Data Panel

Data Panel por pilares

Efectos fijos

library(plm)
## Warning: package 'plm' was built under R version 4.4.1
## 
## Adjuntando el paquete: 'plm'
## The following objects are masked from 'package:dplyr':
## 
##     between, lag, lead
fijo_pi <- plm(log(pbi)~ind_cap+ind_cohes+ind_equi+ind_segu+log(exp), index = c("region","year"), model = "within", data= NUSEDAT)
summary(fijo_pi)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = log(pbi) ~ ind_cap + ind_cohes + ind_equi + ind_segu + 
##     log(exp), data = NUSEDAT, model = "within", index = c("region", 
##     "year"))
## 
## Balanced Panel: n = 26, T = 25, N = 650
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -0.431514 -0.075143 -0.006775  0.070220  0.549142 
## 
## Coefficients:
##             Estimate Std. Error t-value  Pr(>|t|)    
## ind_cap    0.2992083  0.0638954  4.6828 3.480e-06 ***
## ind_cohes -0.2174159  0.0345333 -6.2958 5.795e-10 ***
## ind_equi   0.3005527  0.0368835  8.1487 2.041e-15 ***
## ind_segu   0.0759248  0.0478399  1.5871     0.113    
## log(exp)   0.0888265  0.0081785 10.8610 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    30.5
## Residual Sum of Squares: 10.53
## R-Squared:      0.65477
## Adj. R-Squared: 0.63804
## F-statistic: 234.798 on 5 and 619 DF, p-value: < 2.22e-16

Efectos aleatorios

library(plm)
aleatorio_pi <- plm(log(pbi)~ind_cap+ind_cohes+ind_equi+ind_segu+log(exp), index = c("region","year"), model = "random", data= NUSEDAT)
summary(aleatorio_pi)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = log(pbi) ~ ind_cap + ind_cohes + ind_equi + ind_segu + 
##     log(exp), data = NUSEDAT, model = "random", index = c("region", 
##     "year"))
## 
## Balanced Panel: n = 26, T = 25, N = 650
## 
## Effects:
##                   var std.dev share
## idiosyncratic 0.01701 0.13042 0.033
## individual    0.50481 0.71050 0.967
## theta: 0.9633
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -0.4684571 -0.0877581 -0.0012459  0.0836587  0.4961057 
## 
## Coefficients:
##               Estimate Std. Error z-value  Pr(>|z|)    
## (Intercept) 15.2123421  0.1632885 93.1624 < 2.2e-16 ***
## ind_cap      0.2974517  0.0658184  4.5193 6.205e-06 ***
## ind_cohes   -0.2140443  0.0355695 -6.0176 1.770e-09 ***
## ind_equi     0.3004044  0.0379950  7.9064 2.649e-15 ***
## ind_segu     0.0723603  0.0492728  1.4686     0.142    
## log(exp)     0.0941463  0.0083783 11.2369 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    31.881
## Residual Sum of Squares: 11.627
## R-Squared:      0.63531
## Adj. R-Squared: 0.63248
## Chisq: 1121.89 on 5 DF, p-value: < 2.22e-16

Test de Hausman

phtest(fijo_pi, aleatorio_pi)
## 
##  Hausman Test
## 
## data:  log(pbi) ~ ind_cap + ind_cohes + ind_equi + ind_segu + log(exp)
## chisq = 8.6691, df = 5, p-value = 0.123
## alternative hypothesis: one model is inconsistent

Data panel - ind

Efectos fijos

library(plm)
fijo_ind <- plm(log(pbi)~IRBS+log(exp), index = c("region","year"), model = "within", data= NUSEDAT)
summary(fijo_ind)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = log(pbi) ~ IRBS + log(exp), data = NUSEDAT, model = "within", 
##     index = c("region", "year"))
## 
## Balanced Panel: n = 26, T = 25, N = 650
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -0.4206037 -0.1139524 -0.0044547  0.0929421  0.6110343 
## 
## Coefficients:
##          Estimate Std. Error t-value  Pr(>|t|)    
## IRBS     1.356487   0.095510  14.203 < 2.2e-16 ***
## log(exp) 0.134082   0.010254  13.076 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    30.5
## Residual Sum of Squares: 17.916
## R-Squared:      0.41259
## Adj. R-Squared: 0.38709
## F-statistic: 218.441 on 2 and 622 DF, p-value: < 2.22e-16

Efectos Aleatorios.

aleatorio_ind <- plm(log(pbi)~IRBS+log(exp), index = c("region","year"), model = "random", data= NUSEDAT)
summary(aleatorio_ind)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = log(pbi) ~ IRBS + log(exp), data = NUSEDAT, model = "random", 
##     index = c("region", "year"))
## 
## Balanced Panel: n = 26, T = 25, N = 650
## 
## Effects:
##                  var std.dev share
## idiosyncratic 0.0288  0.1697 0.048
## individual    0.5769  0.7596 0.952
## theta: 0.9554
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -0.4652583 -0.1107972 -0.0076255  0.0959372  0.5615118 
## 
## Coefficients:
##              Estimate Std. Error z-value  Pr(>|z|)    
## (Intercept) 14.395740   0.174040  82.715 < 2.2e-16 ***
## IRBS         1.346104   0.097366  13.825 < 2.2e-16 ***
## log(exp)     0.140830   0.010375  13.574 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    32.545
## Residual Sum of Squares: 19.382
## R-Squared:      0.40447
## Adj. R-Squared: 0.40262
## Chisq: 439.419 on 2 DF, p-value: < 2.22e-16

Test de hausman

phtest(fijo_ind, aleatorio_ind)
## 
##  Hausman Test
## 
## data:  log(pbi) ~ IRBS + log(exp)
## chisq = 18.28, df = 2, p-value = 0.0001073
## alternative hypothesis: one model is inconsistent