Generalized Linear Model
Details
Let y be a vector of response variable of accessing credit for each applicant \(n\), such that \(y_{i}=1\) if the applicant-\(i\) has access to credit, and zero otherwise. Furthermore, let let \(\bold{x} = x_{ij}\), where \(i=1,\ldots,n\) and \(j=1,\ldots,p\) characteristics of the applicants. The log-odds can be define as:
$$log(\frac{\pi_{i}}{1-\pi_{i}}) = \beta_{0}+\bold{x}_{\bold{i}}\beta = \beta_{0}+\sum_{i=1}^{p}\beta_{i}\bold{x}_{i}$$
\(\beta_{0}\) is the intercept, \(\beta = (\beta_{1},\ldots, \beta_{p})\) is a \(p\) \(x\) \(1\) vector of coefficients and \(\bold{x_{i}}\) is the \(i_{th}\) row of x.
Examples
yvar <- c("multi.level")
sample_data <- sample_data[c(1:750),]
xvar <- c("sex", "married", "age", "havejob", "educ", "political.afl",
"rural", "region", "fin.intermdiaries", "fin.knowldge", "income")
BchMk.GLM <- GLM_Model(sample_data, c(xvar, "networth"), yvar )
#> + Fold01: parameter=none
#> - Fold01: parameter=none
#> + Fold02: parameter=none
#> - Fold02: parameter=none
#> + Fold03: parameter=none
#> - Fold03: parameter=none
#> + Fold04: parameter=none
#> - Fold04: parameter=none
#> + Fold05: parameter=none
#> - Fold05: parameter=none
#> + Fold06: parameter=none
#> - Fold06: parameter=none
#> + Fold07: parameter=none
#> - Fold07: parameter=none
#> + Fold08: parameter=none
#> - Fold08: parameter=none
#> + Fold09: parameter=none
#> - Fold09: parameter=none
#> + Fold10: parameter=none
#> - Fold10: parameter=none
#> Aggregating results
#> Fitting final model on full training set
#> Warning: glm.fit: algorithm did not converge
BchMk.GLM$finalModel
#>
#> Call: glm(formula = Data.sub.train[, yvar] ~ ., family = binomial(link = "logit"),
#> data = Data.sub.train)
#>
#> Coefficients:
#> (Intercept) sex married age
#> -1.20704 -0.06493 -0.06183 -0.75239
#> havejob educ political.afl rural
#> 0.13974 0.09900 -0.05111 -0.17108
#> region fin.intermdiaries fin.knowldge income
#> 0.01923 0.01041 0.08658 0.69631
#> networth
#> 0.19579
#>
#> Degrees of Freedom: 600 Total (i.e. Null); 588 Residual
#> Null Deviance: 690.4
#> Residual Deviance: 591.3 AIC: 617.3
BchMk.GLM$Roc$auc
#> Multi-class area under the curve: 0.7555