library(rio)
data=import("dataPeru.xlsx")
# Crear las variables porcentuales
data$porcentaje_sunat <- data$contribuyentesSunat / data$pobTotal * 100
data$porcentaje_pea <- data$peaOcupada / data$pobTotal * 100
# Modelo de regresión lineal múltiple
modelo <- lm(buenEstado ~ porcentaje_sunat + porcentaje_pea, data = data)
# Resultados del modelo
summary(modelo)
##
## Call:
## lm(formula = buenEstado ~ porcentaje_sunat + porcentaje_pea,
## data = data)
##
## 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
## porcentaje_sunat 0.1003 0.3121 0.321 0.751
## porcentaje_pea 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
modelo_pea <- lm(peaOcupada ~ contribuyentesSunat + buenEstado, data = data)
summary(modelo_pea)
##
## Call:
## lm(formula = peaOcupada ~ contribuyentesSunat + buenEstado, data = data)
##
## 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 **
## contribuyentesSunat 9.206e-01 1.741e-02 52.872 < 2e-16 ***
## 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