library(readxl)
library(readxl)
datos_tesis1 <- read_excel("C:/Users/Isabella/Desktop/datos tesis1.xlsx", 
    col_types = c("numeric", "text", "text", 
        "text", "numeric", "text", "text", 
        "numeric", "text", "text", "numeric", 
        "text", "text", "numeric", "text", 
        "text", "text", "text", "text", "text", 
        "numeric", "text", "text", "text", 
        "text", "text", "text"))
modelo1=glm(formula= Y~EDAD, family="binomial", data = datos_tesis1)
summary(modelo1)
## 
## Call:
## glm(formula = Y ~ EDAD, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2837  -1.2624   0.7913   1.0403   1.1535  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.04836    0.12917  -0.374    0.708    
## EDAD         0.06233    0.01233   5.053 4.34e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 917.58  on 714  degrees of freedom
## AIC: 921.58
## 
## Number of Fisher Scoring iterations: 4
modelo2=glm(formula= Y~EMPLEADOS, family="binomial", data = datos_tesis1)
summary(modelo2)
## 
## Call:
## glm(formula = Y ~ EMPLEADOS, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.3518  -1.3665   0.9267   0.9994   0.9994  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.43427    0.08143   5.333 9.65e-08 ***
## EMPLEADOS    0.18884    0.07666   2.463   0.0138 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 939.84  on 714  degrees of freedom
## AIC: 943.84
## 
## Number of Fisher Scoring iterations: 4
modelo3=glm(formula =Y ~+DEUDAASUMIDA, family = "binomial", data=datos_tesis1)
summary(modelo3)
## 
## Call:
## glm(formula = Y ~ +DEUDAASUMIDA, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.3119  -1.0654   0.3784   1.2936   1.2936  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)    -0.2692     0.0961  -2.801  0.00509 ** 
## DEUDAASUMIDA1   2.8699     0.2565  11.190  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 741.64  on 714  degrees of freedom
## AIC: 745.64
## 
## Number of Fisher Scoring iterations: 5
modelo4a=glm(formula =Y ~X1, family = "binomial", data=datos_tesis1)
summary(modelo4a)
## 
## Call:
## glm(formula = Y ~ X1, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.7825  -1.0858   0.2052   1.2719   1.2719  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.21936    0.09222  -2.379   0.0174 *  
## X11          4.06951    0.46124   8.823   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 702.79  on 714  degrees of freedom
## AIC: 706.79
## 
## Number of Fisher Scoring iterations: 6
modelo4b=glm(formula =Y ~X2, family = "binomial", data=datos_tesis1)
summary(modelo4b)
## 
## Call:
## glm(formula = Y ~ X2, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4003  -1.4003   0.9698   0.9698   1.0579  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.51007    0.07757   6.576 4.84e-11 ***
## X21         -0.22239    0.76769  -0.290    0.772    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 947.78  on 714  degrees of freedom
## AIC: 951.78
## 
## Number of Fisher Scoring iterations: 4
modelo4c=glm(formula =Y ~X3, family = "binomial", data=datos_tesis1)
summary(modelo4c)
## 
## Call:
## glm(formula = Y ~ X3, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4023  -1.4023   0.9681   0.9681   1.1127  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.51462    0.07794   6.603 4.04e-11 ***
## X31         -0.36047    0.56178  -0.642    0.521    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 947.46  on 714  degrees of freedom
## AIC: 951.46
## 
## Number of Fisher Scoring iterations: 4
modelo4d=glm(formula =Y ~X4, family = "binomial", data=datos_tesis1)
summary(modelo4d)
## 
## Call:
## glm(formula = Y ~ X4, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4006  -1.4006   0.9695   0.9695   1.0383  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.51083    0.07785   6.562 5.32e-11 ***
## X41         -0.17435    0.59069  -0.295    0.768    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 947.78  on 714  degrees of freedom
## AIC: 951.78
## 
## Number of Fisher Scoring iterations: 4
modelo4e=glm(formula =Y ~X5, family = "binomial", data=datos_tesis1)
summary(modelo4e)
## 
## Call:
## glm(formula = Y ~ X5, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.3963  -1.3963   0.9733   0.9733   0.9733  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   0.50111    0.07726   6.486 8.83e-11 ***
## X51          14.06495  509.65213   0.028    0.978    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 945.03  on 714  degrees of freedom
## AIC: 949.03
## 
## Number of Fisher Scoring iterations: 13
modelo5=glm(formula =Y ~CC, family = "binomial", data=datos_tesis1)
summary(modelo5)
## 
## Call:
## glm(formula = Y ~ CC, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5928  -1.3348   0.8127   1.0278   1.0278  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.36270    0.08881   4.084 4.43e-05 ***
## CC1          0.57557    0.18345   3.138   0.0017 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 937.61  on 714  degrees of freedom
## AIC: 941.61
## 
## Number of Fisher Scoring iterations: 4
modelo6=glm(formula =Y ~FORMAJURIDICA, family = "binomial", data=datos_tesis1)
summary(modelo6)
## 
## Call:
## glm(formula = Y ~ FORMAJURIDICA, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.4823  -1.3663   0.9005   0.9996   0.9996  
## 
## Coefficients:
##                Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     0.43382    0.09146   4.743  2.1e-06 ***
## FORMAJURIDICA1  0.25932    0.17173   1.510    0.131    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 944.97  on 713  degrees of freedom
## Residual deviance: 942.66  on 712  degrees of freedom
##   (2 observations deleted due to missingness)
## AIC: 946.66
## 
## Number of Fisher Scoring iterations: 4
modelo7=glm(formula =Y ~RUT, family = "binomial", data=datos_tesis1)
summary(modelo7)
## 
## Call:
## glm(formula = Y ~ RUT, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.5365  -1.2106   0.8567   0.8567   1.1446  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.07778    0.11898   0.654    0.513    
## RUT1         0.73566    0.15814   4.652 3.29e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 926.05  on 714  degrees of freedom
## AIC: 930.05
## 
## Number of Fisher Scoring iterations: 4
modelo8=glm(formula =Y ~SOLVENCIA, family = "binomial", data=datos_tesis1)
summary(modelo8)
## 
## Call:
## glm(formula = Y ~ SOLVENCIA, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##    Min      1Q  Median      3Q     Max  
## -2.196  -1.334   1.028   1.028   1.028  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.36124    0.08048   4.489 7.16e-06 ***
## SOLVENCIA1   1.95552    0.40416   4.838 1.31e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 911.08  on 714  degrees of freedom
## AIC: 915.08
## 
## Number of Fisher Scoring iterations: 4
modelo9=glm(formula =Y ~MORA, family = "binomial", data=datos_tesis1)
summary(modelo9)
## 
## Call:
## glm(formula = Y ~ MORA, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.9728  -1.3859   0.9823   0.9823   0.9823  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.47796    0.07804   6.124  9.1e-10 ***
## MORA1        1.31380    0.62847   2.090   0.0366 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 942.11  on 714  degrees of freedom
## AIC: 946.11
## 
## Number of Fisher Scoring iterations: 4
modelo10a=glm(formula =Y ~+M1, family = "binomial", data=datos_tesis1)
summary(modelo10a)
## 
## Call:
## glm(formula = Y ~ +M1, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2218  -1.2267   0.4208   1.1289   1.1289  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.11515    0.08629   1.335    0.182    
## M11          2.26439    0.28335   7.992 1.33e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 848.16  on 714  degrees of freedom
## AIC: 852.16
## 
## Number of Fisher Scoring iterations: 5
modelo10b=glm(formula =Y ~+M2, family = "binomial", data=datos_tesis1)
summary(modelo10b)
## 
## Call:
## glm(formula = Y ~ +M2, family = "binomial", data = datos_tesis1)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.3357  -1.2462   0.3677   1.1102   1.1102  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.16020    0.08456   1.894   0.0582 .  
## M21          2.50006    0.33785   7.400 1.36e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 947.87  on 715  degrees of freedom
## Residual deviance: 850.77  on 714  degrees of freedom
## AIC: 854.77
## 
## Number of Fisher Scoring iterations: 5