Processing math: 100%
Skip to contents

Generalized Linear Model

Usage

GLM_Model(Data, xvar, yvar)

Arguments

Data

The name of the Dataset.

xvar

X variables.

yvar

Y variable.

Value

The output from GLM_Model.

Details

Let y be a vector of response variable of accessing credit for each applicant n, such that yi=1 if the applicant-i has access to credit, and zero otherwise. Furthermore, let let \boldx=xij, where i=1,,n and j=1,,p characteristics of the applicants. The log-odds can be define as:

log(πi1πi)=β0+\boldx\boldiβ=β0+pi=1βi\boldxi

β0 is the intercept, β=(β1,,βp) is a p x 1 vector of coefficients and \boldxi is the ith 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