#El modelo tiene como fin explicar la necesidad de financiamiento y esto con base a los ahorros, ingresos, etc. que resulten altamemte significativos para el modelo, este no mide el riesgo de credito por parte del cliente pero en cambio se pueden hacer otro tipo de algoritmos.
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## corrplot 0.88 loaded
##
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
##
## Attaching package: 'memisc'
## The following objects are masked from 'package:dplyr':
##
## collect, recode, rename, syms
## The following object is masked from 'package:htmltools':
##
## css
## The following objects are masked from 'package:stats':
##
## contr.sum, contr.treatment, contrasts
## The following object is masked from 'package:base':
##
## as.array
##
## Attaching package: 'ggplot2'
## The following object is masked from 'package:memisc':
##
## syms
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following objects are masked from 'package:memisc':
##
## rename, style
## The following object is masked from 'package:MASS':
##
## select
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
##
## Attaching package: 'performance'
## The following object is masked from 'package:ROCR':
##
## performance
##
## Attaching package: 'lares'
## The following objects are masked from 'package:performance':
##
## mae, mse, rmse
credit <- read_csv("D:/RSTUDIO/credit logit rstudio/credit.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## id_socio = col_double(),
## col = col_double(),
## estatus_col = col_character(),
## sexo = col_character(),
## ing = col_double(),
## dep = col_double(),
## edad = col_double(),
## est_vivienda = col_character(),
## ant_trab = col_double(),
## est_civil = col_character(),
## ant_comp = col_double(),
## aho_total = col_double()
## )
## id_socio col estatus_col sexo
## Min. : 204 Min. :0.000 Length:946 Length:946
## 1st Qu.:31755 1st Qu.:0.000 Class :character Class :character
## Median :57451 Median :1.000 Mode :character Mode :character
## Mean :51678 Mean :0.667
## 3rd Qu.:73404 3rd Qu.:1.000
## Max. :86505 Max. :1.000
## ing dep edad est_vivienda
## Min. : 400 Min. : 0.000 Min. :18.00 Length:946
## 1st Qu.: 5322 1st Qu.: 0.000 1st Qu.:37.00 Class :character
## Median : 8000 Median : 1.000 Median :47.00 Mode :character
## Mean : 10175 Mean : 1.542 Mean :48.66
## 3rd Qu.: 12000 3rd Qu.: 2.000 3rd Qu.:60.00
## Max. :100000 Max. :30.000 Max. :94.00
## ant_trab est_civil ant_comp aho_total
## Min. : 0.0 Length:946 Min. : 1.00 Min. : 0
## 1st Qu.: 5.0 Class :character 1st Qu.: 4.00 1st Qu.: 4544
## Median :10.0 Mode :character Median : 8.00 Median : 12278
## Mean :13.8 Mean :11.72 Mean : 21224
## 3rd Qu.:19.0 3rd Qu.:17.00 3rd Qu.: 22647
## Max. :92.0 Max. :47.00 Max. :468836
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
#### Se pueden observar los datos y ver cuales son los que estan en el sector de mayormente significativos.
##
## Call:
## glm(formula = col ~ ling + sexo + ant_comp + lahorro, family = "binomial",
## data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.6758 -0.5528 0.5559 0.7419 1.8951
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -6.481227 1.224094 -5.295 1.19e-07 ***
## ling 0.298513 0.131024 2.278 0.0227 *
## sexoMasculino -0.303635 0.171349 -1.772 0.0764 .
## ant_comp -0.050239 0.007694 -6.530 6.59e-11 ***
## lahorro 0.600821 0.053771 11.174 < 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: 1203.82 on 945 degrees of freedom
## Residual deviance: 920.69 on 941 degrees of freedom
## AIC: 930.69
##
## Number of Fisher Scoring iterations: 5
####Se entiende que los valores de ingresos, sexo, masculino, antimguedad en la compañia y el ahorro son altamente signoficativos para explicar la colocacion
## col ant_comp ling lahorro
## col 1.00 -0.10 0.17 0.34
## ant_comp -0.10 1.00 -0.17 0.21
## ling 0.17 -0.17 1.00 0.23
## lahorro 0.34 0.21 0.23 1.00
## Warning in ind1:ind2: numerical expression has 2 elements: only the first used
## Warning in text.default(pos.xlabel[, 1], pos.xlabel[, 2], newcolnames, srt =
## tl.srt, : "sade.col" is not a graphical parameter
## Warning in text.default(pos.xlabel[, 1], pos.xlabel[, 2], newcolnames, srt =
## tl.srt, : "addcolorlabel" is not a graphical parameter
## Warning in text.default(pos.ylabel[, 1], pos.ylabel[, 2], newrownames, col =
## tl.col, : "sade.col" is not a graphical parameter
## Warning in text.default(pos.ylabel[, 1], pos.ylabel[, 2], newrownames, col =
## tl.col, : "addcolorlabel" is not a graphical parameter
## Warning in title(title, ...): "sade.col" is not a graphical parameter
## Warning in title(title, ...): "addcolorlabel" is not a graphical parameter

#### se entiende que la por la matriz colocacion que a un mayor nivel de ahorro hay un mayor nivel de colocacion
## Warning in .font_global(font, quiet = FALSE): Font 'Arial Narrow' is not
## installed, has other name, or can't be found

### El numero de observaciones que hemos predicho con exactitud es de 745 de un total de 946

## No trace type specified:
## Based on info supplied, a 'scatter' trace seems appropriate.
## Read more about this trace type -> https://plotly.com/r/reference/#scatter
## No scatter mode specifed:
## Setting the mode to markers
## Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode
## Warning: `line.width` does not currently support multiple values.