library(readxl)
data2 <- read_xlsx("C:/Users/jcssa/Downloads/dataPeru.xlsx")
data2$ratiopea <- data2$peaOcupada*100/data2$pobTotal
data2$ratiosunat <- data2$contribuyentesSunat*100/data2$pobTotal


modelo2= lm(data2$buenEstado ~ data2$ratiosunat + data2$ratiopea)
summary(modelo2)
## 
## Call:
## lm(formula = data2$buenEstado ~ data2$ratiosunat + data2$ratiopea)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10.0928  -4.3610   0.2575   4.4003  11.0196 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)
## (Intercept)      -22.6095    15.9617  -1.416    0.171
## data2$ratiosunat   0.1003     0.3121   0.321    0.751
## data2$ratiopea     1.0218     0.6424   1.590    0.126
## 
## Residual standard error: 6.299 on 22 degrees of freedom
## Multiple R-squared:  0.4669, Adjusted R-squared:  0.4184 
## F-statistic: 9.633 on 2 and 22 DF,  p-value: 0.000989
modelo3 <- lm(data2$peaOcupada ~ data2$contribuyentesSunat + data2$buenEstado)
summary(modelo3)
## 
## Call:
## lm(formula = data2$peaOcupada ~ data2$contribuyentesSunat + data2$buenEstado)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -91867 -58573 -11166  46174 155851 
## 
## Coefficients:
##                             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                1.155e+05  3.787e+04   3.049  0.00588 ** 
## data2$contribuyentesSunat  9.206e-01  1.741e-02  52.872  < 2e-16 ***
## data2$buenEstado          -1.412e+03  1.983e+03  -0.712  0.48395    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 74540 on 22 degrees of freedom
## Multiple R-squared:  0.9932, Adjusted R-squared:  0.9926 
## F-statistic:  1603 on 2 and 22 DF,  p-value: < 2.2e-16