Carga de datos

Carga de MIP 1990

options(scipen = 9999)
library(readxl)
library(dplyr)
library(kableExtra)

## CONSUMO INTERMEDIO 1990
MIP1990_ci <- read_excel("C:/Users/erick/OneDrive/Escritorio/RESPALDO/UES/Ciclo II - 2023/MAE118/tarea_6_RF21001/MIP1990-2006.xls", 
    sheet = "MIP 1990", range = "i14:bb59", 
    col_names = FALSE)
names(MIP1990_ci)<-as.character(1:46)

#Demanda Final 1990
MIP1990_h <- read_excel("C:/Users/erick/OneDrive/Escritorio/RESPALDO/UES/Ciclo II - 2023/MAE118/tarea_6_RF21001/MIP1990-2006.xls", 
    sheet = "MIP 1990", range = "bd14:be59", 
    col_names = FALSE)
names(MIP1990_h)<-as.character(1:2)

#Vector de producción 1990
MIP1990_X <- read_excel("C:/Users/erick/OneDrive/Escritorio/RESPALDO/UES/Ciclo II - 2023/MAE118/tarea_6_RF21001/MIP1990-2006.xls", 
    sheet = "MIP 1990", range = "bi14:bi59", 
    col_names = FALSE)
names(MIP1990_X)<-c("X")

# Realizamos agregaciones al sector servicios propuesta en clases
servicios_fila<-colSums(MIP1990_ci[41:46,])
temporal_1990<-rbind(MIP1990_ci[1:40,],servicios_fila)
servicios_colum<-rowSums(temporal_1990[,41:46])
MIP1990_ci_corregida<-cbind(temporal_1990[,1:40],servicios_colum)
names(MIP1990_ci_corregida)<-as.character(1:41)

X_1990<-rbind(MIP1990_X[1:40,],colSums(MIP1990_X[41:46,]))

# Tabla con nombres

tabla_nombres <- read_excel("C:/Users/erick/OneDrive/Escritorio/RESPALDO/UES/Ciclo II - 2023/MAE118/tarea_6_RF21001/MIP1990-2006.xls", 
    sheet = "SECTOR", range = "B2:B42", 
    col_names = FALSE)
names(tabla_nombres)<-c("sector")

Carga de MIP 2006

## CONSUMO INTERMEDIO 2006
MIP2006_ci <- read_excel("C:/Users/erick/OneDrive/Escritorio/RESPALDO/UES/Ciclo II - 2023/MAE118/tarea_6_RF21001/MIP1990-2006.xls", 
    sheet = "MIP 2006", range = "i15:bb60", 
    col_names = FALSE)
names(MIP2006_ci)<-as.character(1:46)

#Demanda Final 2006
MIP2006_h <- read_excel("C:/Users/erick/OneDrive/Escritorio/RESPALDO/UES/Ciclo II - 2023/MAE118/tarea_6_RF21001/MIP1990-2006.xls", 
    sheet = "MIP 2006", range = "bd15:be60", 
    col_names = FALSE)
names(MIP2006_h)<-as.character(1:2)

#Vector de producción 2006
MIP2006_X <- read_excel("C:/Users/erick/OneDrive/Escritorio/RESPALDO/UES/Ciclo II - 2023/MAE118/tarea_6_RF21001/MIP1990-2006.xls", 
    sheet = "MIP 2006", range = "bi15:bi60", 
    col_names = FALSE)
names(MIP2006_X)<-c("X")

# Realizamos agregaciones al sector servicios propuesta en clases
servicios_row<-colSums(MIP2006_ci[41:46,])
temporal<-rbind(MIP2006_ci[1:40,],servicios_row)
servicios_col<-rowSums(temporal[,41:46])
MIP2006_ci_corregida<-cbind(temporal[,1:40],servicios_col)
names(MIP2006_ci_corregida)<-as.character(1:41)

X_2006<-rbind(MIP2006_X[1:40,],colSums(MIP2006_X[41:46,]))

Carga de funciones MIP

#Matriz de coeficientes técnicos
MIP_coeficientes_tecnicos<-function(matriz_consumo_intermedio,
                                    vector_demanda_final){
  filas_ci<-nrow(matriz_consumo_intermedio)
  columnas_ci<-ncol(matriz_consumo_intermedio)
  filas_x<-nrow(vector_demanda_final)
  if(filas_ci!=columnas_ci){
    stop("Ingrese una matriz de Consumo Intermedio, Cuadrada",call. = FALSE)
  }
  if(filas_ci!=filas_x){
    stop("Vector de demanda final incompatible (diferente dimensión)",call. = FALSE)
  }
  v<-solve(diag(as.vector(vector_demanda_final)))
  A<-matriz_consumo_intermedio%*%v
  list(A=A,V=v)
}

#matriz tecnológica

MIP_matriz_tecnologica<-function(matriz_coeficientes_tecnicos){
  filas_A<-nrow(matriz_coeficientes_tecnicos)
  columnas_A<-ncol(matriz_coeficientes_tecnicos)
  if(filas_A!=columnas_A){
    stop("Ingrese una matriz de coeficientes tecnicos cuadrada",call. = FALSE)
  }
  tipo_matriz<-typeof(matriz_coeficientes_tecnicos)
  if(tipo_matriz!="double"){
    stop("La matriz ingresada no es numerica",call. = FALSE)
  }
  T<-diag(1,filas_A)-matriz_coeficientes_tecnicos
  T
}

#Matriz Leontief

MIP_matriz_leontief<-function(matriz_tecnologica){
  L<-solve(matriz_tecnologica)
  L
}

# mp
 
MIP_multiplicadores_produccion_mp<-function(matriz_leontief){
  mp<-rowSums(matriz_leontief)
  mp
}

#me

MIP_multiplicadores_expansion_demanda_me<-function(matriz_leontief){
  me<-colSums(matriz_leontief)
  me
}

#pd

MIP_encadenamiento_pd<-function(matriz_leontief){
  mp<-MIP_multiplicadores_produccion_mp(matriz_leontief)
  mp/mean(mp)
}

#sd

MIP_encadenamiento_sd<-function(matriz_leontief){
  me<-MIP_multiplicadores_expansion_demanda_me(matriz_leontief)
  me/mean(me)
}

#tabla

MIP_tabla_rasmussen<-function(matriz_leontief){
library(dplyr)
pd<-MIP_encadenamiento_pd(matriz_leontief)
sd<-MIP_encadenamiento_sd(matriz_leontief)
rasmussen<-data.frame(pd=pd,sd=sd)
rasmussen_clasificado<-rasmussen %>% 
  mutate(clasificacion=case_when(pd>1 & sd>1 ~ "Sector Clave",
                                           pd<1 & sd>1 ~"Sector Estrategico",
                                           pd>1 & sd<1 ~"Sector Impulsor",
                                           pd<1 & sd<1 ~"Sector Isla",
                                           TRUE ~ "No clasificado")) %>% mutate(sector=row_number()) %>% select(sector,pd,sd,clasificacion)
rasmussen_clasificado
}

1. Cálculo de multiplicadores y tasa de cambio

Indicación: Realice el cálculo de lo siguiente (de ser necesario haga las agregaciones de servicios propuestas en la clase):

  • Multiplicadores de Expansión de la demanda (me) para la MIP 1990 y para la MIP 2006.
  • Multiplicadores de la producción (mp) para la MIP 1990 y para la MIP 2006.
  • Tasa de cambio para ambos multiplicadores (por ejemplo, para me: me2006/me1990-1).
  • Presente los resultados en una tabla que incluya los nombres para todos los sectores.

Multiplicadores de Expansión (me) 1990 y 2006.

  • Multiplicador de expansión para 1990
# Cálculo de datos 1990 

A_1990<-MIP_coeficientes_tecnicos(as.matrix(MIP1990_ci_corregida),as.matrix(X_1990))[[1]]
matriz_T_1990<-MIP_matriz_tecnologica(matriz_coeficientes_tecnicos = A_1990)
L_1990<-MIP_matriz_leontief(matriz_tecnologica = matriz_T_1990)
# Utilizamos función de multuplicador de expansión (me)
me_1990<-MIP_multiplicadores_expansion_demanda_me(matriz_leontief = L_1990)

print(me_1990)
##  [1]  1.255178  1.267747  1.261599  1.568111  1.124569  1.445002  1.768326
##  [8]  1.029765  1.383834  1.047445  1.834384  1.788561  1.059243  1.799649
## [15]  1.840519  1.553178  1.365915  1.384794  1.505731  1.642505  1.578688
## [22]  1.361625  1.665210  1.447935  1.327641  1.408787  1.395278  1.459492
## [29]  2.366807  1.299373  1.109323  1.451591  1.392119  1.826914 37.440804
## [36]  1.636206  1.517817  1.258089  1.353294  1.170121  1.301949
  • Multiplicador de expansión para 2006
# Cálculo de datos 2006 
A_2006<-MIP_coeficientes_tecnicos(as.matrix(MIP2006_ci_corregida),as.matrix(X_2006))[[1]]
matriz_T_2006<-MIP_matriz_tecnologica(matriz_coeficientes_tecnicos = A_2006)
L_2006<-MIP_matriz_leontief(matriz_tecnologica = matriz_T_2006)

# Utilizamos función de multuplicador de expansión (me)
me_2006<-MIP_multiplicadores_expansion_demanda_me(matriz_leontief = L_2006)

print(me_2006)
##  [1]  1.297922  1.020215  1.234962  1.847889  1.083978  1.400624  1.685844
##  [8]  1.026941  1.499664  1.071302  1.401085  1.471804  1.040887  1.526300
## [15]  1.941532  1.344572  1.277062  1.000000  1.301245  1.371596  1.395160
## [22]  1.176944  1.433429  1.363739  1.212840  1.240559  1.276547  1.496298
## [29]  1.990601  1.109025  1.088510  1.588449  2.124461  1.674974 23.762309
## [36]  1.299292  1.397290  1.684696  1.236529  1.171619  1.360409

Multiplicadores de la producción (mp) 1990 y 2006.

  • Multiplicador de la producción 1990
mp_1990<-MIP_multiplicadores_produccion_mp(L_1990)
print(mp_1990)
##  [1]  1.105885  1.191285  1.750077  1.511243  1.389578  2.181171  1.119400
##  [8]  1.246299  1.083152  3.671425  1.223539  1.133089  1.006271  1.592563
## [15]  1.194635  2.224389  1.253500  1.015813  1.928648  1.030379  1.189543
## [22]  1.146679  2.696695  2.739024  3.150917  6.985378  2.603476  1.606020
## [29]  2.197902  1.495203  2.066329  2.185642  1.177725  1.239212  1.067583
## [36]  1.291981 13.816987  2.262777  3.717322  7.533336  3.673047
  • Multiplicador de la producción 2006
mp_2006<-MIP_multiplicadores_produccion_mp(L_2006)
print(mp_2006)
##  [1]  1.013829  1.052815  1.474348  1.301361  1.244981  1.623459  1.060766
##  [8]  1.196731  1.359658  2.568025  1.150131  1.077882  1.002044  1.355794
## [15]  1.054278  1.918127  1.134142  1.000527  1.470996  1.018324  1.129994
## [22]  1.107301  2.018467  1.888203  2.150340  6.346229  1.563541  1.509519
## [29]  1.791534  1.250410  1.532295  2.797425  1.081905  1.187016  1.062057
## [36]  1.197085 10.302597  1.590620  1.766302  6.502581  3.075466

Tasa de cambio para ambos multiplicadores.

tabla <- data.frame(me_1990=me_1990, 
                    me_2006=me_2006, 
                    mp_1990=mp_1990, 
                    mp_2006=mp_2006) %>% 
  mutate(tc_me=round((me_2006/me_1990-1)*100,2),
         tc_mp=round((mp_2006/mp_1990-1)*100,2)) %>% 
  select(me_1990,me_2006,tc_me,mp_1990,mp_2006,tc_mp) %>% 
  print()
##      me_1990   me_2006  tc_me   mp_1990   mp_2006  tc_mp
## 1   1.255178  1.297922   3.41  1.105885  1.013829  -8.32
## 2   1.267747  1.020215 -19.53  1.191285  1.052815 -11.62
## 3   1.261599  1.234962  -2.11  1.750077  1.474348 -15.76
## 4   1.568111  1.847889  17.84  1.511243  1.301361 -13.89
## 5   1.124569  1.083978  -3.61  1.389578  1.244981 -10.41
## 6   1.445002  1.400624  -3.07  2.181171  1.623459 -25.57
## 7   1.768326  1.685844  -4.66  1.119400  1.060766  -5.24
## 8   1.029765  1.026941  -0.27  1.246299  1.196731  -3.98
## 9   1.383834  1.499664   8.37  1.083152  1.359658  25.53
## 10  1.047445  1.071302   2.28  3.671425  2.568025 -30.05
## 11  1.834384  1.401085 -23.62  1.223539  1.150131  -6.00
## 12  1.788561  1.471804 -17.71  1.133089  1.077882  -4.87
## 13  1.059243  1.040887  -1.73  1.006271  1.002044  -0.42
## 14  1.799649  1.526300 -15.19  1.592563  1.355794 -14.87
## 15  1.840519  1.941532   5.49  1.194635  1.054278 -11.75
## 16  1.553178  1.344572 -13.43  2.224389  1.918127 -13.77
## 17  1.365915  1.277062  -6.51  1.253500  1.134142  -9.52
## 18  1.384794  1.000000 -27.79  1.015813  1.000527  -1.50
## 19  1.505731  1.301245 -13.58  1.928648  1.470996 -23.73
## 20  1.642505  1.371596 -16.49  1.030379  1.018324  -1.17
## 21  1.578688  1.395160 -11.63  1.189543  1.129994  -5.01
## 22  1.361625  1.176944 -13.56  1.146679  1.107301  -3.43
## 23  1.665210  1.433429 -13.92  2.696695  2.018467 -25.15
## 24  1.447935  1.363739  -5.81  2.739024  1.888203 -31.06
## 25  1.327641  1.212840  -8.65  3.150917  2.150340 -31.76
## 26  1.408787  1.240559 -11.94  6.985378  6.346229  -9.15
## 27  1.395278  1.276547  -8.51  2.603476  1.563541 -39.94
## 28  1.459492  1.496298   2.52  1.606020  1.509519  -6.01
## 29  2.366807  1.990601 -15.90  2.197902  1.791534 -18.49
## 30  1.299373  1.109025 -14.65  1.495203  1.250410 -16.37
## 31  1.109323  1.088510  -1.88  2.066329  1.532295 -25.84
## 32  1.451591  1.588449   9.43  2.185642  2.797425  27.99
## 33  1.392119  2.124461  52.61  1.177725  1.081905  -8.14
## 34  1.826914  1.674974  -8.32  1.239212  1.187016  -4.21
## 35 37.440804 23.762309 -36.53  1.067583  1.062057  -0.52
## 36  1.636206  1.299292 -20.59  1.291981  1.197085  -7.34
## 37  1.517817  1.397290  -7.94 13.816987 10.302597 -25.44
## 38  1.258089  1.684696  33.91  2.262777  1.590620 -29.70
## 39  1.353294  1.236529  -8.63  3.717322  1.766302 -52.48
## 40  1.170121  1.171619   0.13  7.533336  6.502581 -13.68
## 41  1.301949  1.360409   4.49  3.673047  3.075466 -16.27

Presentación de resultados por sectores

tabla %>% 
  cbind(tabla_nombres) %>% 
  select(everything(), sector) %>% 
  kable(caption="Tasa de cambio de los multiplicadores(me y mp) MIP 1990 y 2006",
        align = "c",
        digits = 2) %>% 
  kable_material(html_font = "sans-serif") %>% 
  kable_styling(bootstrap_options = c("striped", "hover"))
Tasa de cambio de los multiplicadores(me y mp) MIP 1990 y 2006
me_1990 me_2006 tc_me mp_1990 mp_2006 tc_mp sector
1.26 1.30 3.41 1.11 1.01 -8.32
  1. CAFE ORO
1.27 1.02 -19.53 1.19 1.05 -11.62
  1. ALGODON
1.26 1.23 -2.11 1.75 1.47 -15.76
  1. GRANOS BASICOS
1.57 1.85 17.84 1.51 1.30 -13.89
  1. CAÑA DE AZUCAR
1.12 1.08 -3.61 1.39 1.24 -10.41
  1. OTRAS PRODUCCIONES AGRICOLAS
1.45 1.40 -3.07 2.18 1.62 -25.57
  1. GANADERIA
1.77 1.69 -4.66 1.12 1.06 -5.24
  1. AVICULTURA
1.03 1.03 -0.27 1.25 1.20 -3.98
  1. SILVICULTURA
1.38 1.50 8.37 1.08 1.36 25.53
  1. PROD. DE LA CAZA Y LA PESCA
1.05 1.07 2.28 3.67 2.57 -30.05
  1. PROD. DE LA MINERIA
1.83 1.40 -23.62 1.22 1.15 -6.00
  1. CARNE Y SUS PRODUCTOS
1.79 1.47 -17.71 1.13 1.08 -4.87
  1. PRODUCTOS LACTEOS
1.06 1.04 -1.73 1.01 1.00 -0.42
  1. PROD. ELABORADOS DE LA PESCA
1.80 1.53 -15.19 1.59 1.36 -14.87
  1. PROD. DE MOLINERIA Y PANADERIA
1.84 1.94 5.49 1.19 1.05 -11.75
  1. AZUCAR
1.55 1.34 -13.43 2.22 1.92 -13.77
  1. OTROS PROD. ALIM. ELABORADOS
1.37 1.28 -6.51 1.25 1.13 -9.52
  1. BEBIDAS
1.38 1.00 -27.79 1.02 1.00 -1.50
  1. TABACO ELABORADO
1.51 1.30 -13.58 1.93 1.47 -23.73
  1. TEXTILES Y ART. CONFEC. DE MAT. TEXT.
1.64 1.37 -16.49 1.03 1.02 -1.17
  1. PRENDAS DE VESTIR
1.58 1.40 -11.63 1.19 1.13 -5.01
  1. CUERO Y SUS PRODUCTOS
1.36 1.18 -13.56 1.15 1.11 -3.43
  1. MADERA Y SUS PRODUCTOS
1.67 1.43 -13.92 2.70 2.02 -25.15
  1. PAPEL, CARTON Y SUS PRODUCTOS
1.45 1.36 -5.81 2.74 1.89 -31.06
  1. PROD. DE LA IMPRENTA Y DE IND. CONEX.
1.33 1.21 -8.65 3.15 2.15 -31.76
  1. QUIMICA DE BASE Y ELABORADOS
1.41 1.24 -11.94 6.99 6.35 -9.15
  1. PROD. DE LA REFINACION DE PETROLEO
1.40 1.28 -8.51 2.60 1.56 -39.94
  1. PROD. DE CAUCHO Y PLASTICO
1.46 1.50 2.52 1.61 1.51 -6.01
  1. PROD. MINERALESS NO METALICOS ELAB.
2.37 1.99 -15.90 2.20 1.79 -18.49
  1. PROD. METALICOS DE BASE Y ELAB.
1.30 1.11 -14.65 1.50 1.25 -16.37
  1. MAQUINARIA, EQUIPOS Y SUMINISTROS
1.11 1.09 -1.88 2.07 1.53 -25.84
  1. MATERIAL DE TRANSP. Y MANUF. DIVERSAS
1.45 1.59 9.43 2.19 2.80 27.99
  1. ELECTRICIDAD
1.39 2.12 52.61 1.18 1.08 -8.14
  1. AGUA Y ALCANTARILLADOS
1.83 1.67 -8.32 1.24 1.19 -4.21
  1. CONSTRUCCION
37.44 23.76 -36.53 1.07 1.06 -0.52
  1. COMERCIO
1.64 1.30 -20.59 1.29 1.20 -7.34
  1. RESTAURANTES Y HOTELES
1.52 1.40 -7.94 13.82 10.30 -25.44
  1. TRANSP. Y ALMACENAMIENTO
1.26 1.68 33.91 2.26 1.59 -29.70
  1. COMUNICACIONES
1.35 1.24 -8.63 3.72 1.77 -52.48
  1. BANCOS, SEGUROS, OTRAS INST. FINANC.
1.17 1.17 0.13 7.53 6.50 -13.68
  1. BIENES INMUEBLES Y SERV. PRESTADOS
1.30 1.36 4.49 3.67 3.08 -16.27
  1. SERVICIOS

2. Análisis de Rasmussen 1990 y 2006

Análisis de Rasmussen para MIP 1990.

rasmussen_1990<-MIP_tabla_rasmussen(L_1990) 

summary_rasmussen_1990 <- rasmussen_1990 %>% 
  group_by(clasificacion) %>% summarise(total=n()) %>% mutate(porcentaje=round(prop.table(total)*100,2))

summary_rasmussen_1990 %>% 
  kable(aption="Análisis de Rasmussen para MIP 1990",
        align = "c",
        digits = 2) %>% 
  kable_material(html_font = "sans-serif") %>% 
  kable_styling(bootstrap_options = c("striped", "hover"))
clasificacion total porcentaje
Sector Estrategico 2 4.88
Sector Impulsor 10 24.39
Sector Isla 29 70.73

Análisis de Rasmussen para MIP 2006.

rasmussen_2006<-MIP_tabla_rasmussen(L_2006) 

summary_rasmussen_2006 <- rasmussen_2006 %>% 
  group_by(clasificacion) %>% summarise(total=n()) %>% mutate(porcentaje=round(prop.table(total)*100,2))
  
summary_rasmussen_2006 %>% 
  kable(aption="Análisis de Rasmussen para MIP 2006",
        align = "c",
        digits = 2) %>% 
  kable_material(html_font = "sans-serif") %>% 
  kable_styling(bootstrap_options = c("striped", "hover"))
clasificacion total porcentaje
Sector Estrategico 4 9.76
Sector Impulsor 8 19.51
Sector Isla 29 70.73

3. Tabla comparativa por tipo de sector.

tabla_comparativa<-left_join(summary_rasmussen_1990, summary_rasmussen_2006, by="clasificacion", suffix=c("_1990","_2006"))

tabla_comparativa %>% 
  mutate(TC_porcentual= round((porcentaje_2006/porcentaje_1990-1)*100,2)) %>% 
  kable(caption="Tabla comparativa",
        align = "c",
        digits = 2) %>% 
  kable_material(html_font = "sans-serif") %>% 
  kable_styling(bootstrap_options = c("striped", "hover"))
Tabla comparativa
clasificacion total_1990 porcentaje_1990 total_2006 porcentaje_2006 TC_porcentual
Sector Estrategico 2 4.88 4 9.76 100.00
Sector Impulsor 10 24.39 8 19.51 -20.01
Sector Isla 29 70.73 29 70.73 0.00