R Markdown

\[ \text{Numerador} = (6 \cdot \sum (\text{Horas } T \cdot \text{Ingresos})) - \left( \sum (\text{Horas } T) \cdot \sum (\text{Ingresos}) \right) \]

library(readxl)
Datos <- read_excel("D:/DOCUMENTOS DE USUARIO/Downloads/Datos.xlsx")
View(Datos)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
head(Datos)
## # A tibble: 6 × 7
##   CodMun Municipio  Departamento MortalidadMenores PorcentajeDeforesta
##    <dbl> <chr>      <chr>                    <dbl>               <dbl>
## 1   5001 Medellín   Antioquia                 9.55              0.0822
## 2   5002 Abejorral  Antioquia                11.1               0.0680
## 3   5004 Abriaquí   Antioquia                23.8               0.0846
## 4   5021 Alejandría Antioquia                15.8               0.346 
## 5   5030 Amagá      Antioquia                10.8               0.327 
## 6   5031 Amalfi     Antioquia                 9.35              0.586 
## # ℹ 2 more variables: IndiceVulneraClima <dbl>, IPM_Total <dbl>
modelo_lin <- lm(IPM_Total ~ MortalidadMenores + IndiceVulneraClima, data = Datos)
summary(modelo_lin)
## 
## Call:
## lm(formula = IPM_Total ~ MortalidadMenores + IndiceVulneraClima, 
##     data = Datos)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -40.41 -11.30  -0.98  10.54  40.02 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        38.88325    2.12417  18.305  < 2e-16 ***
## MortalidadMenores   0.47521    0.04316  11.012  < 2e-16 ***
## IndiceVulneraClima -0.37232    0.10511  -3.542 0.000413 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.96 on 1098 degrees of freedom
## Multiple R-squared:  0.1104, Adjusted R-squared:  0.1088 
## F-statistic: 68.14 on 2 and 1098 DF,  p-value: < 2.2e-16