library(readxl)
dataPeru <- read_excel("dataPeru.xlsx")
View(dataPeru)
str(dataPeru)
## tibble [25 × 8] (S3: tbl_df/tbl/data.frame)
## $ DEPARTAMENTO : chr [1:25] "AMAZONAS" "ÁNCASH" "APURÍMAC" "AREQUIPA" ...
## $ UBIGEO : chr [1:25] "010000" "020000" "030000" "040000" ...
## $ buenEstado : num [1:25] 18.6 13.9 8.7 27.4 17 18 33.8 11.9 10.1 15.6 ...
## $ contribuyentesSunat: num [1:25] 75035 302906 103981 585628 151191 ...
## $ peaOcupada : num [1:25] 130019 387976 140341 645001 235857 ...
## $ pobUrbana : num [1:25] 205976 806065 243354 1383694 444473 ...
## $ PobRural : num [1:25] 211389 333050 180905 76739 206467 ...
## $ pobTotal : num [1:25] 417365 1139115 424259 1460433 650940 ...
para sacar el porcentaje de pea laburando se debe crear una nueva
variable uniendo la pea y la población total
dataPeru$porPea=(dataPeru$peaOcupada/dataPeru$pobTotal*100)
lo mismo para el porcentaje de contribuyentes al SUNAT
dataPeru$porSunat=(dataPeru$contribuyentesSunat/dataPeru$pobTotal*100)
modelo1=formula(buenEstado~porSunat+porPea)
reg1=lm(modelo1,data=dataPeru)
summary(reg1)
##
## Call:
## lm(formula = modelo1, data = dataPeru)
##
## 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
## porSunat 0.1003 0.3121 0.321 0.751
## porPea 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
se concluye que a un 0.05 de singificancia ninguno de los
porcentajes tiene efecto
modelo2=formula(peaOcupada~contribuyentesSunat+buenEstado)
reg2=lm(modelo2, data=dataPeru)
summary(reg2)
##
## Call:
## lm(formula = modelo2, data = dataPeru)
##
## 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
Se concluye que los contribuyentes a SUNAT tienen efecto