#install.packages("corrplot")
library(data.table)
library(sandwich)
library(tidyverse)
library(lmtest)
library(ggplot2)
library(knitr)
library(psych)
library(dplyr)
library(readr)
library(stargazer)
library(corrplot)
library(caret)
library(class)
library(gmodels)
library(naivebayes)
library(ggplot2)
set.seed(123456)
dta_bank=read.csv('/Users/tangziyu/Downloads/Bank Case.csv')
str(dta_bank)
## 'data.frame': 41188 obs. of 12 variables:
## $ age : int 56 57 37 40 56 45 59 41 24 25 ...
## $ job : Factor w/ 12 levels "admin.","blue-collar",..: 4 8 8 1 8 8 1 2 10 8 ...
## $ marital : Factor w/ 4 levels "divorced","married",..: 2 2 2 2 2 2 2 2 3 3 ...
## $ education : Factor w/ 8 levels "basic.4y","basic.6y",..: 1 4 4 2 4 3 6 8 6 4 ...
## $ default : Factor w/ 3 levels "no","unknown",..: 1 2 1 1 1 2 1 2 1 1 ...
## $ housing : Factor w/ 3 levels "no","unknown",..: 1 1 3 1 1 1 1 1 3 3 ...
## $ loan : Factor w/ 3 levels "no","unknown",..: 1 1 1 1 3 1 1 1 1 1 ...
## $ contact : Factor w/ 2 levels "cellular","telephone": 2 2 2 2 2 2 2 2 2 2 ...
## $ month : Factor w/ 10 levels "apr","aug","dec",..: 7 7 7 7 7 7 7 7 7 7 ...
## $ day_of_week: Factor w/ 5 levels "fri","mon","thu",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ duration : int 261 149 226 151 307 198 139 217 380 50 ...
## $ y : Factor w/ 2 levels "no","yes": 1 1 1 1 1 1 1 1 1 1 ...
There are 12 variables in the dataset, including job, marital, education, default, housing, loan, contact, month, day of week, and whether the household actually decided to join the bank (y) which are categorical variables, and age and duration which are numerical variables whose units are year and second respectively.
Both age and duration have outliers: there are 99 records whose ages are more than 4 times age’s standard deviation and 386 records whose duration are more than 4 times duration’s standard deviation.
For data cleaning, I drop the records whose durations are unusually long (more than 1295.402 seconds which is 4 times its standard deviation). Furthermore, I drop the records whose ages are unusually old (more than 81.7328 years which is 4 times its standard deviation).
Finally, I get the cleaned data set without outliers, containing 40,703 records.
# age
str(as.data.table(dta_bank[dta_bank$age>mean(dta_bank$age)+4*sd(dta_bank$age),]))
## Classes 'data.table' and 'data.frame': 99 obs. of 12 variables:
## $ age : int 88 88 88 88 88 88 88 88 88 88 ...
## $ job : Factor w/ 12 levels "admin.","blue-collar",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ marital : Factor w/ 4 levels "divorced","married",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ education : Factor w/ 8 levels "basic.4y","basic.6y",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ default : Factor w/ 3 levels "no","unknown",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ housing : Factor w/ 3 levels "no","unknown",..: 3 1 3 3 3 1 3 3 3 3 ...
## $ loan : Factor w/ 3 levels "no","unknown",..: 1 1 3 1 1 1 1 1 3 3 ...
## $ contact : Factor w/ 2 levels "cellular","telephone": 1 1 1 1 1 1 1 1 1 1 ...
## $ month : Factor w/ 10 levels "apr","aug","dec",..: 6 6 6 6 6 6 6 6 6 6 ...
## $ day_of_week: Factor w/ 5 levels "fri","mon","thu",..: 5 5 5 5 5 5 5 5 5 5 ...
## $ duration : int 48 266 796 96 126 323 85 101 103 82 ...
## $ y : Factor w/ 2 levels "no","yes": 1 2 2 1 2 2 1 2 1 1 ...
## - attr(*, ".internal.selfref")=<externalptr>
# duration
str(as.data.table(dta_bank[dta_bank$duration>mean(dta_bank$duration)+4*sd(dta_bank$duration),]))
## Classes 'data.table' and 'data.frame': 386 obs. of 12 variables:
## $ age : int 52 41 49 39 42 42 42 32 45 41 ...
## $ job : Factor w/ 12 levels "admin.","blue-collar",..: 10 2 10 8 10 5 2 10 4 2 ...
## $ marital : Factor w/ 4 levels "divorced","married",..: 2 1 2 1 2 2 2 2 2 2 ...
## $ education : Factor w/ 8 levels "basic.4y","basic.6y",..: 3 1 3 4 6 7 4 6 6 1 ...
## $ default : Factor w/ 3 levels "no","unknown",..: 1 2 1 2 1 1 1 1 2 1 ...
## $ housing : Factor w/ 3 levels "no","unknown",..: 3 3 1 1 1 1 1 1 3 3 ...
## $ loan : Factor w/ 3 levels "no","unknown",..: 1 1 1 1 1 1 3 1 1 1 ...
## $ contact : Factor w/ 2 levels "cellular","telephone": 2 2 2 2 2 2 2 2 2 2 ...
## $ month : Factor w/ 10 levels "apr","aug","dec",..: 7 7 7 7 7 7 7 7 7 7 ...
## $ day_of_week: Factor w/ 5 levels "fri","mon","thu",..: 2 2 2 2 4 4 4 4 4 4 ...
## $ duration : int 1666 1575 1467 2033 1623 1677 1297 1906 1597 1529 ...
## $ y : Factor w/ 2 levels "no","yes": 1 2 2 1 2 2 2 1 2 1 ...
## - attr(*, ".internal.selfref")=<externalptr>
#clean data: eliminate the outliers
dta_bank=dta_bank[dta_bank$age<=mean(dta_bank$age)+4*sd(dta_bank$age),]
dta_bank=dta_bank[dta_bank$duration<=mean(dta_bank$duration)+4*sd(dta_bank$duration),]
str(dta_bank)
## 'data.frame': 40703 obs. of 12 variables:
## $ age : int 56 57 37 40 56 45 59 41 24 25 ...
## $ job : Factor w/ 12 levels "admin.","blue-collar",..: 4 8 8 1 8 8 1 2 10 8 ...
## $ marital : Factor w/ 4 levels "divorced","married",..: 2 2 2 2 2 2 2 2 3 3 ...
## $ education : Factor w/ 8 levels "basic.4y","basic.6y",..: 1 4 4 2 4 3 6 8 6 4 ...
## $ default : Factor w/ 3 levels "no","unknown",..: 1 2 1 1 1 2 1 2 1 1 ...
## $ housing : Factor w/ 3 levels "no","unknown",..: 1 1 3 1 1 1 1 1 3 3 ...
## $ loan : Factor w/ 3 levels "no","unknown",..: 1 1 1 1 3 1 1 1 1 1 ...
## $ contact : Factor w/ 2 levels "cellular","telephone": 2 2 2 2 2 2 2 2 2 2 ...
## $ month : Factor w/ 10 levels "apr","aug","dec",..: 7 7 7 7 7 7 7 7 7 7 ...
## $ day_of_week: Factor w/ 5 levels "fri","mon","thu",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ duration : int 261 149 226 151 307 198 139 217 380 50 ...
## $ y : Factor w/ 2 levels "no","yes": 1 1 1 1 1 1 1 1 1 1 ...
M = cor(model.matrix(~.-1,dta_bank))
corrplot(M, order = "AOE",cl.pos = "b",tl.pos = "n", tl.srt = 60,method = "circle")
# Y equals to 0 when the decision is no, 1 when that is yes
dta_bank$y=sapply(as.character(dta_bank$y), switch, 'no' = 0, 'yes' = 1)
summary(lm(y~.,data=dta_bank))
##
## Call:
## lm(formula = y ~ ., data = dta_bank)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.98957 -0.11512 -0.03708 0.02732 1.07354
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 8.353e-03 1.222e-02 0.684 0.494208
## age 7.104e-04 1.655e-04 4.293 1.77e-05 ***
## jobblue-collar -2.690e-02 4.908e-03 -5.482 4.23e-08 ***
## jobentrepreneur -2.706e-02 7.606e-03 -3.558 0.000375 ***
## jobhousemaid -7.815e-03 9.084e-03 -0.860 0.389648
## jobmanagement -1.987e-02 5.723e-03 -3.472 0.000517 ***
## jobretired 6.244e-02 8.077e-03 7.730 1.10e-14 ***
## jobself-employed -2.445e-02 7.641e-03 -3.200 0.001377 **
## jobservices -2.204e-02 5.329e-03 -4.135 3.55e-05 ***
## jobstudent 1.176e-01 9.893e-03 11.882 < 2e-16 ***
## jobtechnician -1.529e-02 4.724e-03 -3.238 0.001206 **
## jobunemployed 1.929e-02 8.915e-03 2.164 0.030464 *
## jobunknown 1.020e-02 1.534e-02 0.664 0.506376
## maritalmarried 7.788e-03 4.354e-03 1.789 0.073650 .
## maritalsingle 2.252e-02 4.998e-03 4.506 6.63e-06 ***
## maritalunknown -8.807e-03 3.027e-02 -0.291 0.771111
## educationbasic.6y 5.996e-03 7.087e-03 0.846 0.397549
## educationbasic.9y -3.145e-03 5.608e-03 -0.561 0.574879
## educationhigh.school 1.505e-03 5.809e-03 0.259 0.795593
## educationilliterate 1.161e-01 6.288e-02 1.846 0.064846 .
## educationprofessional.course 8.215e-03 6.533e-03 1.258 0.208575
## educationuniversity.degree 1.763e-02 5.928e-03 2.975 0.002932 **
## educationunknown 2.126e-02 7.975e-03 2.666 0.007676 **
## defaultunknown -3.956e-02 3.453e-03 -11.457 < 2e-16 ***
## defaultyes -4.216e-02 1.537e-01 -0.274 0.783859
## housingunknown 5.751e-03 8.753e-03 0.657 0.511197
## housingyes 2.396e-03 2.693e-03 0.890 0.373538
## loanunknown NA NA NA NA
## loanyes -1.343e-03 3.695e-03 -0.363 0.716342
## contacttelephone -7.780e-02 3.489e-03 -22.299 < 2e-16 ***
## monthaug -6.798e-02 6.356e-03 -10.696 < 2e-16 ***
## monthdec 2.374e-01 2.102e-02 11.293 < 2e-16 ***
## monthjul -8.676e-02 6.174e-03 -14.052 < 2e-16 ***
## monthjun 1.350e-03 6.958e-03 0.194 0.846114
## monthmar 3.122e-01 1.279e-02 24.412 < 2e-16 ***
## monthmay -6.664e-02 6.044e-03 -11.026 < 2e-16 ***
## monthnov -7.108e-02 6.748e-03 -10.535 < 2e-16 ***
## monthoct 2.392e-01 1.146e-02 20.877 < 2e-16 ***
## monthsep 2.284e-01 1.265e-02 18.062 < 2e-16 ***
## day_of_weekmon -9.613e-03 4.199e-03 -2.289 0.022066 *
## day_of_weekthu 2.075e-03 4.194e-03 0.495 0.620660
## day_of_weektue 3.693e-03 4.262e-03 0.866 0.386227
## day_of_weekwed 5.465e-03 4.255e-03 1.284 0.199021
## duration 5.637e-04 6.181e-06 91.204 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2661 on 40660 degrees of freedom
## Multiple R-squared: 0.2584, Adjusted R-squared: 0.2577
## F-statistic: 337.4 on 42 and 40660 DF, p-value: < 2.2e-16
\[y=0.00835+0.00071*age-0.0269*bluecollar-0.02706*entrepreneur-0.00781*housemaid-0.01987*management+0.06244*retired-0.02445*self-employed-0.02204*services+0.11755*student-0.01529*technician+0.01929*unemployed+0.0102job.unknown+0.00779*married+0.02252*single-0.00881marital.unknown+0.006*basic.6y-0.00315*basic.9y+0.0015*high.school+0.1161*illiterate+0.00822*professional.course+0.01763*university.degree+0.02126*education.unknown-0.03956*default.unknown-0.04216*default.yes+0.00575*housing.unknown+0.0024*housing.yes-0.00134*loan.yes-0.0778*telephone-0.06798*aug+0.23736*dec-0.08676*jul+0.00135*jun+0.31219*mar-0.06664*may-0.07108*nov+0.23921*oct+0.2284*sep-0.00961*mon+0.00208*thu+0.00369*tue+0.00546*wed+0.00056*duration\]
The best time to perform telemarketing tasks is Wednesday in March, because the coefficients on Wednesday and March are positive and the biggest among all days of week and months. Plus, the coefficient on March is statistically significant while that on Wednesday is not.
The best income group is student, whose coefficient is positive and the biggest among all income groups.
There may be some omitted variables which are correlated with the characteristics of customers and their decision about whether to join the bank, resulting in the omitted variable bias. For example, the time of the day (morning, afternoon, after-work, etc.) can be a ommitted variable. A retired person may have more free time during the day to answer the phone patiently and make a decision to join the bank, causing the upward bias. Thus, we should concern about these omitted variable bias and try to eliminate them.
We always divide the data set in training, validating,and testing because we use different datasets for different purposes.
Training dataset is the one on which we train and fit our model basically to fit the parameter. The model sees and learns from this data.
Validation dataset is the sample of data used to provide an unbiased evaluation of a model fit on the training dataset while tuning model hyperparameters. The evaluation becomes more biased as skill on the validation dataset is incorporated into the model configuration. Hence the model occasionally sees this data, but never does it “Learn” from this. We use the validation set results and update higher level hyperparameters. So the validation set in a way affects a model, but indirectly.
Test data is used only to assess performance of model, that is, the sample of data used to provide an unbiased evaluation of a final model fit on the training dataset. It is only used once a model is completely trained (using the train and validation sets). We will use test data to evaluate models and choose which one has the best predictive performance among all.
As for how to divide the dataset, it depends on how large the dataset is.
The logic behind is that if you lower the number of samples in the training, the samples for the model being built will have too few samples, resulting in the inaccuracy. There are two competing concerns: with less training data, your parameter estimates have greater variance. With less testing data, your performance statistic will have greater variance. Broadly speaking, you should be concerned with dividing data such that neither variance is too high. According to the literatures, you can have 60%-80% of dataset for training to better model the underlying distribution and then validating and testing the results with the reamining 40%-20%. Generally, 80/20 is quite a commonly occurring ratio, and for the last assignment we were recommended to use the ratios: training 80%, validation 10% and testing 10%.
Yes, we should drop the variable named “duration”. According to the information about this dataset, duration is the last contact duration, whose unit is seconds (numeric). This attribute highly affects the output target (e.g., if duration=0 then y=‘no’). Yet, the duration is not known before a call is performed. Also, after the end of the call y is obviously known. Thus, this input should only be included for benchmark purposes and should be discarded if the intention is to have a realistic predictive model.
dta_bank$duration=NULL
dta=dta_bank
Overfitting happens when a model learns the detail and noise in the training data to the extent that it negatively impacts the performance of the model on new data. Specifically, overfitting occurs if the model or algorithm shows low bias but high variance. This means that the noise or random fluctuation in the training data is picked up and learned as concepts by the model.
The problem is that these concepts do not apply to new data and negatively impact the models ability to generalize.
This problem can be prevented by fitting multiple models and using validation or cross-validation to compare their predictive accuracies on test data.
Underfitting occurs when a statistical model or machine learning algorithm cannot capture the underlying trend of the data. Specifically, underfitting occurs if the model or algorithm shows low variance but high bias.
The problem is that underfitting is often a result of an excessively simple model. However, underfitting is rare to see.
In conclusion, both overfitting and underfitting lead to poor predictions on new data sets, which we need to pay attention to.
In computational complexity and optimization the no free lunch theorem is a result that states that for certain types of mathematical problems, the computational cost of finding a solution, averaged over all problems in the class, is the same for any solution method.
In the past, people were keen to study more efficient optimization methods. No free lunch theorem tells us that no algorithm is more efficient than others. But this is not to say that these studies are meaningless, because in practical applications, some algorithms are significantly more efficient than others, which is not an illusion. Because the premise of no free lunch theorem is to consider all possible objective functions, but only a few of them will actually be encountered in real life, which is “free lunch”.
No free lunch theorem is not to say that it is meaningless to study optimization algorithm, but to remind us to change our thinking and design and improve the algorithm from the set (or distribution) of problems.
# Generate index for spliting original dataset
set.seed(123456)
len = nrow(dta_bank)
train_index = sample(1:len, round(len*0.8, 0))
val_index = sample((1:len)[-train_index], round(len*0.1, 0))
test_index = (1:len)[-c(train_index, val_index)]
cat(sprintf('[Description]\n Number of sample: %7s\n Training set: %11s\n Validation set: %8s\n Test set: %14s',
len, length(train_index), length(val_index), length(test_index)))
## [Description]
## Number of sample: 40703
## Training set: 32562
## Validation set: 4070
## Test set: 4071
# Generate training set, validation set and testing set
X = colnames(dta_bank)[colnames(dta_bank) != 'y']
train_x = dta_bank[train_index, X]
train_y = (dta_bank[train_index, ])$y
val_x = dta_bank[val_index, X]
val_y = (dta_bank[val_index, ])$y
test_x = dta_bank[test_index, X]
test_y = (dta_bank[test_index, ])$y
dataset_list = list(train_x=train_x, train_y=train_y, val_x=val_x,
val_y=val_y, test_x=test_x, test_y=test_y,
train_n=length(train_index), val_n=length(val_index), test_n=length(test_index))
dta_train = dta_bank[ train_index, ]
dta_valid = dta_bank[ val_index, ]
dta_test = dta_bank[ test_index, ]
\[y=0.18906+0.00008468*age-0.09175*aug+0.30328*dec-0.10817*jul-0.09171*jun+0.3028*mar-0.13336*may-0.09301*nov+ 0.2558*oct+0.23089*sep\]
lm1 = lm(y~age+factor(month),data=dta_train)
# accuracy of train data
pred_train_lm1 = predict(lm1,dta_train)
pred_train_lm1 = as.data.frame(pred_train_lm1)
pred_train_lm1$y = ifelse(round(pred_train_lm1$pred_train_lm1,2)<0.5,'0','1')
confusionMatrix(as.factor(dta_train$y),as.factor(pred_train_lm1$y))
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 28956 135
## 1 3335 136
##
## Accuracy : 0.8934
## 95% CI : (0.89, 0.8968)
## No Information Rate : 0.9917
## P-Value [Acc > NIR] : 1
##
## Kappa : 0.0581
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.89672
## Specificity : 0.50185
## Pos Pred Value : 0.99536
## Neg Pred Value : 0.03918
## Prevalence : 0.99168
## Detection Rate : 0.88926
## Detection Prevalence : 0.89340
## Balanced Accuracy : 0.69928
##
## 'Positive' Class : 0
##
# accuracy of test data
pred_test_lm1 = predict(lm1,dta_test)
pred_test_lm1 = as.data.frame(pred_test_lm1)
pred_test_lm1$y = ifelse(round(pred_test_lm1$pred_test_lm1,2)<0.5,'0','1')
confusionMatrix(as.factor(dta_test$y),as.factor(pred_test_lm1$y))
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 3635 22
## 1 395 19
##
## Accuracy : 0.8976
## 95% CI : (0.8878, 0.9067)
## No Information Rate : 0.9899
## P-Value [Acc > NIR] : 1
##
## Kappa : 0.0664
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.90199
## Specificity : 0.46341
## Pos Pred Value : 0.99398
## Neg Pred Value : 0.04589
## Prevalence : 0.98993
## Detection Rate : 0.89290
## Detection Prevalence : 0.89831
## Balanced Accuracy : 0.68270
##
## 'Positive' Class : 0
##
\[y=0.59944-0.01855*age+0.00015*age^2+0.000000982*age^3-0.08486*aug+0.26687*dec-0.10534*jul-0.08375*jun+0.28061*mar-0.12389*may-0.08268*nov+ 0.22301*oct+0.20689*sep\]
lm2 = lm(y~age+I(age^2)+I(age^3)+factor(month),data=dta_train)
# accuracy of train data
pred_train_lm2 = predict(lm2,dta_train)
pred_train_lm2 = as.data.frame(pred_train_lm2)
pred_train_lm2$y = ifelse(round(pred_train_lm2$pred_train_lm2,2)<0.5,'0','1')
confusionMatrix(as.factor(dta_train$y),as.factor(pred_train_lm2$y))
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 28890 201
## 1 3303 168
##
## Accuracy : 0.8924
## 95% CI : (0.889, 0.8957)
## No Information Rate : 0.9887
## P-Value [Acc > NIR] : 1
##
## Kappa : 0.0684
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.8974
## Specificity : 0.4553
## Pos Pred Value : 0.9931
## Neg Pred Value : 0.0484
## Prevalence : 0.9887
## Detection Rate : 0.8872
## Detection Prevalence : 0.8934
## Balanced Accuracy : 0.6763
##
## 'Positive' Class : 0
##
# accuracy of test data
pred_test_lm2 = predict(lm2,dta_test)
pred_test_lm2 = as.data.frame(pred_test_lm2)
pred_test_lm2$y = ifelse(round(pred_test_lm2$pred_test_lm2,2)<0.5,'0','1')
confusionMatrix(as.factor(dta_test$y),as.factor(pred_test_lm2$y))
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 3634 23
## 1 398 16
##
## Accuracy : 0.8966
## 95% CI : (0.8868, 0.9058)
## No Information Rate : 0.9904
## P-Value [Acc > NIR] : 1
##
## Kappa : 0.0541
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.90129
## Specificity : 0.41026
## Pos Pred Value : 0.99371
## Neg Pred Value : 0.03865
## Prevalence : 0.99042
## Detection Rate : 0.89266
## Detection Prevalence : 0.89831
## Balanced Accuracy : 0.65577
##
## 'Positive' Class : 0
##
\[y=0.15425+0.00082*age-0.02105*bluecollar-0.02866*entrepreneur-0.00643*housemaid-0.01699*management+0.07517*retired-0.02209*self-employed-0.01643*services+0.13176*student-0.01621*technician+0.02324*unemployed-0.01063*job.unknown+0.00935*married+0.02672*single+0.04115*marital.unknown+0.00154*basic.6y-0.0068*basic.9y-0.00024*high.school+0.09703*illiterate+0.00355*professional.course+0.01393*university.degree+0.02359*education.unknown-0.0407*default.unknown-0.1155*default.yes-0.00385*housing.unknown-0.00137*housing.yes-0.00586*loan.yes-0.09185*telephone-0.09586*aug+0.27659*dec-0.0918*jul-0.01022*jun+0.28567*mar-0.0717*may-0.08847*nov+0.23994*oct+0.21143*sep-0.01104*mon+0.00812*thu+0.01185*tue+ 0.01289*wed\]
lm3 = lm(y~.,data=dta_train)
# accuracy of train data
pred_train_lm3 = predict(lm3,dta_train)
## Warning in predict.lm(lm3, dta_train): prediction from a rank-deficient fit
## may be misleading
pred_train_lm3 = as.data.frame(pred_train_lm3)
pred_train_lm3$y = ifelse(round(pred_train_lm3$pred_train_lm3,2)<0.5,'0','1')
confusionMatrix(as.factor(dta_train$y),as.factor(pred_train_lm3$y))
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 28900 191
## 1 3265 206
##
## Accuracy : 0.8939
## 95% CI : (0.8905, 0.8972)
## No Information Rate : 0.9878
## P-Value [Acc > NIR] : 1
##
## Kappa : 0.0865
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.89849
## Specificity : 0.51889
## Pos Pred Value : 0.99343
## Neg Pred Value : 0.05935
## Prevalence : 0.98781
## Detection Rate : 0.88754
## Detection Prevalence : 0.89340
## Balanced Accuracy : 0.70869
##
## 'Positive' Class : 0
##
# accuracy of test data
pred_test_lm3 = predict(lm3,dta_test)
## Warning in predict.lm(lm3, dta_test): prediction from a rank-deficient fit
## may be misleading
pred_test_lm3 = as.data.frame(pred_test_lm3)
pred_test_lm3$y = ifelse(round(pred_test_lm3$pred_test_lm3,2)<0.5,'0','1')
confusionMatrix(as.factor(dta_test$y),as.factor(pred_test_lm3$y))
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 3625 32
## 1 392 22
##
## Accuracy : 0.8958
## 95% CI : (0.8861, 0.9051)
## No Information Rate : 0.9867
## P-Value [Acc > NIR] : 1
##
## Kappa : 0.0722
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.90241
## Specificity : 0.40741
## Pos Pred Value : 0.99125
## Neg Pred Value : 0.05314
## Prevalence : 0.98674
## Detection Rate : 0.89044
## Detection Prevalence : 0.89831
## Balanced Accuracy : 0.65491
##
## 'Positive' Class : 0
##
\[y=-0.1408+0.002674*age+0.1176*blue.collar+…+0.06242*married+…+0.01070*basic.6y+…-0.08280*default.yes+…-0.02256*housing.yes+…-0.0111*loan.yes+…+0.009964*telephone+0.08066*month*aug+…+0.0225*mon+…+interaction.term.of.each.pair.of.them\]
lm4 = lm(y~.^2,data=dta_train)
summary(lm4)
##
## Call:
## lm(formula = y ~ .^2, data = dta_train)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.86085 -0.10550 -0.05999 -0.01951 1.08169
##
## Coefficients: (106 not defined because of singularities)
## Estimate Std. Error
## (Intercept) -1.408e-01 9.029e-02
## age 2.674e-03 1.378e-03
## jobblue-collar 1.176e-01 6.459e-02
## jobentrepreneur -5.556e-03 8.740e-02
## jobhousemaid 6.701e-02 1.090e-01
## jobmanagement -9.286e-02 7.768e-02
## jobretired -5.288e-01 9.998e-02
## jobself-employed 1.456e-01 9.119e-02
## jobservices 3.503e-02 7.189e-02
## jobstudent 2.885e-01 1.829e-01
## jobtechnician 1.364e-01 7.553e-02
## jobunemployed 1.327e-01 9.942e-02
## jobunknown 1.276e-01 1.899e-01
## maritalmarried 6.242e-02 4.428e-02
## maritalsingle 1.323e-01 5.140e-02
## maritalunknown 2.826e-03 5.780e-01
## educationbasic.6y 1.070e-01 8.812e-02
## educationbasic.9y 8.743e-02 6.924e-02
## educationhigh.school 1.691e-01 7.057e-02
## educationilliterate -8.463e-01 1.284e+00
## educationprofessional.course 1.862e-01 7.645e-02
## educationuniversity.degree 2.984e-01 7.111e-02
## educationunknown 1.184e-01 8.974e-02
## defaultunknown -4.691e-02 3.968e-02
## defaultyes -8.280e-02 9.645e-01
## housingunknown -4.734e-02 9.854e-02
## housingyes -2.256e-02 2.956e-02
## loanunknown NA NA
## loanyes -1.110e-02 4.040e-02
## contacttelephone 9.964e-03 4.342e-02
## monthaug 8.066e-02 6.500e-02
## monthdec 2.203e-01 2.385e-01
## monthjul 6.177e-02 6.134e-02
## monthjun 2.739e-01 7.032e-02
## monthmar 3.636e-01 1.335e-01
## monthmay -8.560e-03 6.041e-02
## monthnov 8.610e-02 6.850e-02
## monthoct 4.693e-01 1.146e-01
## monthsep 7.868e-01 1.442e-01
## day_of_weekmon 2.225e-02 4.447e-02
## day_of_weekthu 1.425e-01 4.457e-02
## day_of_weektue 2.246e-01 4.817e-02
## day_of_weekwed 1.572e-01 4.764e-02
## age:jobblue-collar -1.580e-03 7.687e-04
## age:jobentrepreneur -2.218e-03 1.115e-03
## age:jobhousemaid 2.104e-03 1.265e-03
## age:jobmanagement 3.585e-04 8.484e-04
## age:jobretired 1.179e-02 1.222e-03
## age:jobself-employed -1.657e-03 1.127e-03
## age:jobservices -2.372e-03 8.362e-04
## age:jobstudent -5.508e-03 2.718e-03
## age:jobtechnician -6.178e-04 7.293e-04
## age:jobunemployed -2.270e-03 1.332e-03
## age:jobunknown -7.671e-05 2.183e-03
## age:maritalmarried -4.823e-04 6.369e-04
## age:maritalsingle -2.803e-03 7.476e-04
## age:maritalunknown -1.810e-03 7.821e-03
## age:educationbasic.6y -2.791e-03 1.148e-03
## age:educationbasic.9y -2.246e-03 8.203e-04
## age:educationhigh.school -1.410e-03 8.618e-04
## age:educationilliterate 6.119e-02 7.084e-02
## age:educationprofessional.course -2.506e-03 9.592e-04
## age:educationuniversity.degree -2.346e-03 8.721e-04
## age:educationunknown 1.320e-04 1.183e-03
## age:defaultunknown -9.733e-04 5.188e-04
## age:defaultyes 1.878e-04 2.382e-02
## age:housingunknown 2.369e-03 1.355e-03
## age:housingyes 1.361e-03 4.079e-04
## age:loanunknown NA NA
## age:loanyes 1.083e-03 5.612e-04
## age:contacttelephone -1.112e-03 5.310e-04
## age:monthaug 2.419e-04 1.006e-03
## age:monthdec -3.969e-03 3.393e-03
## age:monthjul 3.288e-04 9.501e-04
## age:monthjun 1.238e-03 1.063e-03
## age:monthmar 1.520e-03 1.897e-03
## age:monthmay 1.739e-03 9.442e-04
## age:monthnov -8.143e-04 1.049e-03
## age:monthoct -5.523e-03 1.607e-03
## age:monthsep -5.618e-03 1.996e-03
## age:day_of_weekmon 4.269e-04 6.421e-04
## age:day_of_weekthu 1.036e-03 6.416e-04
## age:day_of_weektue -5.348e-04 6.514e-04
## age:day_of_weekwed -1.090e-06 6.556e-04
## jobblue-collar:maritalmarried -5.744e-02 2.041e-02
## jobentrepreneur:maritalmarried -7.671e-03 2.934e-02
## jobhousemaid:maritalmarried -1.961e-03 3.377e-02
## jobmanagement:maritalmarried -3.480e-02 2.249e-02
## jobretired:maritalmarried 3.852e-03 2.811e-02
## jobself-employed:maritalmarried -6.706e-02 3.299e-02
## jobservices:maritalmarried -1.257e-02 2.030e-02
## jobstudent:maritalmarried -6.121e-02 1.445e-01
## jobtechnician:maritalmarried -1.522e-02 1.882e-02
## jobunemployed:maritalmarried 5.885e-02 3.538e-02
## jobunknown:maritalmarried -1.658e-01 1.157e-01
## jobblue-collar:maritalsingle -4.673e-02 2.342e-02
## jobentrepreneur:maritalsingle 3.844e-03 3.670e-02
## jobhousemaid:maritalsingle 4.717e-02 4.528e-02
## jobmanagement:maritalsingle -3.087e-02 2.756e-02
## jobretired:maritalsingle 4.865e-02 4.490e-02
## jobself-employed:maritalsingle -9.107e-02 3.676e-02
## jobservices:maritalsingle -1.763e-02 2.305e-02
## jobstudent:maritalsingle -6.940e-02 1.359e-01
## jobtechnician:maritalsingle -6.546e-03 2.075e-02
## jobunemployed:maritalsingle 6.741e-02 4.081e-02
## jobunknown:maritalsingle 9.764e-03 1.250e-01
## jobblue-collar:maritalunknown 2.148e-01 2.306e-01
## jobentrepreneur:maritalunknown 8.963e-01 4.385e-01
## jobhousemaid:maritalunknown 1.045e-01 4.729e-01
## jobmanagement:maritalunknown 2.653e-02 3.391e-01
## jobretired:maritalunknown 7.505e-02 2.755e-01
## jobself-employed:maritalunknown -1.393e-01 3.201e-01
## jobservices:maritalunknown 1.774e-01 2.867e-01
## jobstudent:maritalunknown -4.439e-01 4.856e-01
## jobtechnician:maritalunknown 3.901e-02 1.796e-01
## jobunemployed:maritalunknown -3.489e-01 3.027e-01
## jobunknown:maritalunknown 2.352e-01 2.778e-01
## jobblue-collar:educationbasic.6y 2.374e-02 4.858e-02
## jobentrepreneur:educationbasic.6y 7.672e-02 6.669e-02
## jobhousemaid:educationbasic.6y 4.474e-02 6.294e-02
## jobmanagement:educationbasic.6y 7.755e-02 6.708e-02
## jobretired:educationbasic.6y -4.904e-02 6.488e-02
## jobself-employed:educationbasic.6y 4.371e-02 9.328e-02
## jobservices:educationbasic.6y 6.300e-02 5.901e-02
## jobstudent:educationbasic.6y -1.068e-01 1.290e-01
## jobtechnician:educationbasic.6y -7.256e-02 7.195e-02
## jobunemployed:educationbasic.6y -3.662e-02 7.750e-02
## jobunknown:educationbasic.6y 9.463e-02 1.063e-01
## jobblue-collar:educationbasic.9y -1.234e-02 4.286e-02
## jobentrepreneur:educationbasic.9y -9.446e-03 5.492e-02
## jobhousemaid:educationbasic.9y -3.040e-02 5.698e-02
## jobmanagement:educationbasic.9y 2.257e-02 5.845e-02
## jobretired:educationbasic.9y -7.214e-02 5.325e-02
## jobself-employed:educationbasic.9y -1.929e-02 5.907e-02
## jobservices:educationbasic.9y 1.969e-02 5.321e-02
## jobstudent:educationbasic.9y -1.094e-01 8.729e-02
## jobtechnician:educationbasic.9y -9.970e-02 6.153e-02
## jobunemployed:educationbasic.9y -5.665e-03 5.673e-02
## jobunknown:educationbasic.9y -5.356e-02 9.277e-02
## jobblue-collar:educationhigh.school -1.510e-03 4.231e-02
## jobentrepreneur:educationhigh.school -1.487e-02 5.352e-02
## jobhousemaid:educationhigh.school -2.100e-02 5.084e-02
## jobmanagement:educationhigh.school -2.382e-03 5.489e-02
## jobretired:educationhigh.school -8.583e-02 4.803e-02
## jobself-employed:educationhigh.school -2.998e-02 6.122e-02
## jobservices:educationhigh.school 1.372e-02 4.937e-02
## jobstudent:educationhigh.school -1.013e-01 8.081e-02
## jobtechnician:educationhigh.school -1.409e-01 5.921e-02
## jobunemployed:educationhigh.school -5.466e-02 5.398e-02
## jobunknown:educationhigh.school 5.652e-02 8.550e-02
## jobblue-collar:educationilliterate -6.599e-01 4.269e-01
## jobentrepreneur:educationilliterate 5.217e-02 6.082e-01
## jobhousemaid:educationilliterate -1.034e+00 7.002e-01
## jobmanagement:educationilliterate NA NA
## jobretired:educationilliterate -2.636e+00 2.723e+00
## jobself-employed:educationilliterate 4.870e-01 1.693e+00
## jobservices:educationilliterate NA NA
## jobstudent:educationilliterate NA NA
## jobtechnician:educationilliterate NA NA
## jobunemployed:educationilliterate NA NA
## jobunknown:educationilliterate NA NA
## jobblue-collar:educationprofessional.course -1.997e-02 4.596e-02
## jobentrepreneur:educationprofessional.course -4.614e-02 5.830e-02
## jobhousemaid:educationprofessional.course 3.137e-02 6.241e-02
## jobmanagement:educationprofessional.course 2.659e-02 6.378e-02
## jobretired:educationprofessional.course -6.885e-02 5.164e-02
## jobself-employed:educationprofessional.course -3.129e-02 6.167e-02
## jobservices:educationprofessional.course 2.585e-03 5.564e-02
## jobstudent:educationprofessional.course 3.539e-02 9.869e-02
## jobtechnician:educationprofessional.course -1.257e-01 6.028e-02
## jobunemployed:educationprofessional.course -5.260e-02 5.920e-02
## jobunknown:educationprofessional.course -8.621e-02 1.316e-01
## jobblue-collar:educationuniversity.degree -2.794e-02 5.314e-02
## jobentrepreneur:educationuniversity.degree 1.039e-02 5.053e-02
## jobhousemaid:educationuniversity.degree -1.478e-02 5.185e-02
## jobmanagement:educationuniversity.degree 1.907e-02 5.233e-02
## jobretired:educationuniversity.degree -8.593e-02 4.799e-02
## jobself-employed:educationuniversity.degree -3.195e-02 5.557e-02
## jobservices:educationuniversity.degree 3.795e-02 5.582e-02
## jobstudent:educationuniversity.degree -1.348e-01 8.318e-02
## jobtechnician:educationuniversity.degree -1.314e-01 5.863e-02
## jobunemployed:educationuniversity.degree -7.527e-02 5.437e-02
## jobunknown:educationuniversity.degree 5.333e-02 8.786e-02
## jobblue-collar:educationunknown -7.420e-02 4.758e-02
## jobentrepreneur:educationunknown -2.641e-02 6.785e-02
## jobhousemaid:educationunknown -3.370e-02 6.949e-02
## jobmanagement:educationunknown 1.724e-02 6.290e-02
## jobretired:educationunknown -1.693e-01 6.189e-02
## jobself-employed:educationunknown -3.613e-02 8.447e-02
## jobservices:educationunknown 1.338e-02 5.868e-02
## jobstudent:educationunknown -1.029e-01 8.725e-02
## jobtechnician:educationunknown -1.445e-01 6.473e-02
## jobunemployed:educationunknown -1.447e-03 9.035e-02
## jobunknown:educationunknown 3.040e-02 7.448e-02
## jobblue-collar:defaultunknown 3.229e-02 1.534e-02
## jobentrepreneur:defaultunknown 3.924e-02 2.423e-02
## jobhousemaid:defaultunknown -9.345e-03 2.616e-02
## jobmanagement:defaultunknown 1.209e-02 2.035e-02
## jobretired:defaultunknown -1.676e-02 2.486e-02
## jobself-employed:defaultunknown 2.115e-02 2.640e-02
## jobservices:defaultunknown 2.981e-02 1.736e-02
## jobstudent:defaultunknown -8.049e-02 3.800e-02
## jobtechnician:defaultunknown 2.675e-02 1.684e-02
## jobunemployed:defaultunknown 1.283e-02 2.857e-02
## jobunknown:defaultunknown 3.396e-03 4.876e-02
## jobblue-collar:defaultyes NA NA
## jobentrepreneur:defaultyes NA NA
## jobhousemaid:defaultyes NA NA
## jobmanagement:defaultyes NA NA
## jobretired:defaultyes NA NA
## jobself-employed:defaultyes NA NA
## jobservices:defaultyes NA NA
## jobstudent:defaultyes NA NA
## jobtechnician:defaultyes NA NA
## jobunemployed:defaultyes NA NA
## jobunknown:defaultyes NA NA
## jobblue-collar:housingunknown -2.813e-02 4.003e-02
## jobentrepreneur:housingunknown -1.893e-03 6.021e-02
## jobhousemaid:housingunknown -8.421e-02 6.995e-02
## jobmanagement:housingunknown -8.750e-02 4.656e-02
## jobretired:housingunknown -8.782e-02 6.342e-02
## jobself-employed:housingunknown -2.573e-02 5.893e-02
## jobservices:housingunknown 2.563e-03 4.137e-02
## jobstudent:housingunknown 2.422e-01 8.256e-02
## jobtechnician:housingunknown 2.481e-02 4.006e-02
## jobunemployed:housingunknown -8.101e-02 6.768e-02
## jobunknown:housingunknown -1.046e-01 1.411e-01
## jobblue-collar:housingyes -1.612e-02 1.208e-02
## jobentrepreneur:housingyes 1.003e-02 1.872e-02
## jobhousemaid:housingyes -2.446e-02 2.260e-02
## jobmanagement:housingyes -1.565e-03 1.400e-02
## jobretired:housingyes -7.878e-03 2.011e-02
## jobself-employed:housingyes -3.069e-02 1.900e-02
## jobservices:housingyes -1.073e-02 1.310e-02
## jobstudent:housingyes 4.853e-02 2.451e-02
## jobtechnician:housingyes 3.589e-04 1.159e-02
## jobunemployed:housingyes -2.386e-03 2.217e-02
## jobunknown:housingyes -3.013e-02 4.056e-02
## jobblue-collar:loanunknown NA NA
## jobentrepreneur:loanunknown NA NA
## jobhousemaid:loanunknown NA NA
## jobmanagement:loanunknown NA NA
## jobretired:loanunknown NA NA
## jobself-employed:loanunknown NA NA
## jobservices:loanunknown NA NA
## jobstudent:loanunknown NA NA
## jobtechnician:loanunknown NA NA
## jobunemployed:loanunknown NA NA
## jobunknown:loanunknown NA NA
## jobblue-collar:loanyes -7.065e-03 1.637e-02
## jobentrepreneur:loanyes 4.783e-04 2.616e-02
## jobhousemaid:loanyes 1.106e-02 3.087e-02
## jobmanagement:loanyes 2.611e-02 1.911e-02
## jobretired:loanyes 6.781e-03 2.808e-02
## jobself-employed:loanyes 3.588e-02 2.662e-02
## jobservices:loanyes 2.646e-02 1.790e-02
## jobstudent:loanyes 1.333e-01 3.236e-02
## jobtechnician:loanyes 1.270e-02 1.579e-02
## jobunemployed:loanyes 3.152e-02 3.052e-02
## jobunknown:loanyes -3.163e-02 5.239e-02
## jobblue-collar:contacttelephone 2.546e-02 1.535e-02
## jobentrepreneur:contacttelephone 3.081e-02 2.453e-02
## jobhousemaid:contacttelephone 5.311e-02 3.175e-02
## jobmanagement:contacttelephone 5.417e-03 1.883e-02
## jobretired:contacttelephone -3.991e-03 2.792e-02
## jobself-employed:contacttelephone -2.938e-03 2.430e-02
## jobservices:contacttelephone 1.048e-02 1.645e-02
## jobstudent:contacttelephone -5.303e-02 3.044e-02
## jobtechnician:contacttelephone -2.223e-02 1.578e-02
## jobunemployed:contacttelephone -6.477e-02 2.806e-02
## jobunknown:contacttelephone 1.771e-01 5.970e-02
## jobblue-collar:monthaug 2.426e-02 3.211e-02
## jobentrepreneur:monthaug 1.184e-01 5.527e-02
## jobhousemaid:monthaug -1.390e-01 6.511e-02
## jobmanagement:monthaug 9.823e-02 3.378e-02
## jobretired:monthaug -4.577e-02 4.406e-02
## jobself-employed:monthaug 1.507e-03 4.343e-02
## jobservices:monthaug 8.950e-02 3.456e-02
## jobstudent:monthaug 2.372e-01 5.121e-02
## jobtechnician:monthaug 8.006e-03 2.685e-02
## jobunemployed:monthaug -4.855e-03 5.659e-02
## jobunknown:monthaug 6.063e-02 1.265e-01
## jobblue-collar:monthdec -4.419e-03 1.175e-01
## jobentrepreneur:monthdec NA NA
## jobhousemaid:monthdec -1.163e-01 1.435e-01
## jobmanagement:monthdec -1.946e-01 1.318e-01
## jobretired:monthdec -1.274e-01 1.217e-01
## jobself-employed:monthdec 1.526e-01 1.480e-01
## jobservices:monthdec 6.115e-01 2.292e-01
## jobstudent:monthdec -1.861e-01 1.216e-01
## jobtechnician:monthdec 3.032e-01 9.206e-02
## jobunemployed:monthdec 3.016e-01 1.551e-01
## jobunknown:monthdec NA NA
## jobblue-collar:monthjul 1.141e-02 2.768e-02
## jobentrepreneur:monthjul 5.374e-02 4.168e-02
## jobhousemaid:monthjul -1.663e-01 6.396e-02
## jobmanagement:monthjul 8.844e-02 3.341e-02
## jobretired:monthjul -1.954e-02 4.451e-02
## jobself-employed:monthjul 6.852e-03 4.304e-02
## jobservices:monthjul 6.811e-02 2.932e-02
## jobstudent:monthjul 1.619e-01 4.963e-02
## jobtechnician:monthjul 4.937e-03 2.753e-02
## jobunemployed:monthjul -7.076e-02 5.469e-02
## jobunknown:monthjul 8.392e-02 1.318e-01
## jobblue-collar:monthjun 3.117e-02 3.151e-02
## jobentrepreneur:monthjun 8.511e-02 4.765e-02
## jobhousemaid:monthjun -1.837e-01 6.961e-02
## jobmanagement:monthjun 1.218e-01 3.665e-02
## jobretired:monthjun -6.223e-02 5.093e-02
## jobself-employed:monthjun 3.437e-02 4.615e-02
## jobservices:monthjun 5.904e-02 3.340e-02
## jobstudent:monthjun 1.251e-01 5.239e-02
## jobtechnician:monthjun 6.046e-02 3.117e-02
## jobunemployed:monthjun 1.264e-02 5.795e-02
## jobunknown:monthjun -2.009e-02 1.272e-01
## jobblue-collar:monthmar 1.061e-01 6.893e-02
## jobentrepreneur:monthmar 6.400e-01 2.974e-01
## jobhousemaid:monthmar 1.115e-01 1.420e-01
## jobmanagement:monthmar 3.785e-02 6.289e-02
## jobretired:monthmar -1.986e-01 8.791e-02
## jobself-employed:monthmar -8.169e-02 8.482e-02
## jobservices:monthmar -1.001e-01 8.162e-02
## jobstudent:monthmar 1.134e-01 8.491e-02
## jobtechnician:monthmar 5.577e-02 5.600e-02
## jobunemployed:monthmar 1.208e-01 9.982e-02
## jobunknown:monthmar NA NA
## jobblue-collar:monthmay 1.054e-02 2.717e-02
## jobentrepreneur:monthmay 5.564e-02 4.193e-02
## jobhousemaid:monthmay -1.754e-01 6.575e-02
## jobmanagement:monthmay 8.626e-02 3.243e-02
## jobretired:monthmay -5.253e-02 4.593e-02
## jobself-employed:monthmay 1.789e-02 4.165e-02
## jobservices:monthmay 6.752e-02 2.860e-02
## jobstudent:monthmay 1.284e-01 4.547e-02
## jobtechnician:monthmay 4.933e-02 2.712e-02
## jobunemployed:monthmay 3.819e-03 5.475e-02
## jobunknown:monthmay -5.641e-02 1.222e-01
## jobblue-collar:monthnov 3.057e-02 3.104e-02
## jobentrepreneur:monthnov 4.509e-02 4.227e-02
## jobhousemaid:monthnov -7.281e-02 6.915e-02
## jobmanagement:monthnov 8.110e-02 3.289e-02
## jobretired:monthnov 9.521e-02 4.976e-02
## jobself-employed:monthnov -1.323e-02 4.434e-02
## jobservices:monthnov 3.907e-02 3.351e-02
## jobstudent:monthnov 2.190e-01 6.121e-02
## jobtechnician:monthnov 3.264e-02 2.969e-02
## jobunemployed:monthnov -6.109e-02 5.498e-02
## jobunknown:monthnov 5.378e-01 1.874e-01
## jobblue-collar:monthoct 2.519e-03 6.470e-02
## jobentrepreneur:monthoct 1.771e-01 1.026e-01
## jobhousemaid:monthoct -5.428e-02 1.018e-01
## jobmanagement:monthoct 2.599e-01 5.817e-02
## jobretired:monthoct -4.742e-02 6.705e-02
## jobself-employed:monthoct 5.997e-02 8.747e-02
## jobservices:monthoct 1.013e-01 6.736e-02
## jobstudent:monthoct 5.242e-02 7.055e-02
## jobtechnician:monthoct 1.720e-01 4.956e-02
## jobunemployed:monthoct -9.013e-02 8.180e-02
## jobunknown:monthoct -2.402e-01 1.806e-01
## jobblue-collar:monthsep -1.329e-01 9.009e-02
## jobentrepreneur:monthsep 1.204e-01 1.042e-01
## jobhousemaid:monthsep -3.716e-01 1.412e-01
## jobmanagement:monthsep 1.254e-01 6.388e-02
## jobretired:monthsep -2.379e-01 7.719e-02
## jobself-employed:monthsep -9.772e-02 8.549e-02
## jobservices:monthsep 3.478e-02 7.357e-02
## jobstudent:monthsep -1.761e-01 8.204e-02
## jobtechnician:monthsep 4.557e-02 5.336e-02
## jobunemployed:monthsep -1.223e-01 8.457e-02
## jobunknown:monthsep -1.432e-01 1.774e-01
## jobblue-collar:day_of_weekmon -3.349e-02 1.894e-02
## jobentrepreneur:day_of_weekmon 8.213e-03 2.905e-02
## jobhousemaid:day_of_weekmon -2.710e-02 3.671e-02
## jobmanagement:day_of_weekmon -1.417e-02 2.197e-02
## jobretired:day_of_weekmon 1.193e-03 3.137e-02
## jobself-employed:day_of_weekmon -1.002e-02 2.929e-02
## jobservices:day_of_weekmon -3.468e-02 2.048e-02
## jobstudent:day_of_weekmon -3.138e-02 3.898e-02
## jobtechnician:day_of_weekmon -8.985e-03 1.820e-02
## jobunemployed:day_of_weekmon 3.040e-02 3.486e-02
## jobunknown:day_of_weekmon -1.412e-01 7.151e-02
## jobblue-collar:day_of_weekthu -2.729e-02 1.908e-02
## jobentrepreneur:day_of_weekthu -2.545e-02 2.932e-02
## jobhousemaid:day_of_weekthu -1.780e-02 3.679e-02
## jobmanagement:day_of_weekthu -3.367e-02 2.224e-02
## jobretired:day_of_weekthu -4.173e-02 3.157e-02
## jobself-employed:day_of_weekthu -1.930e-02 2.913e-02
## jobservices:day_of_weekthu -3.168e-02 2.042e-02
## jobstudent:day_of_weekthu -3.479e-02 3.805e-02
## jobtechnician:day_of_weekthu -2.989e-02 1.786e-02
## jobunemployed:day_of_weekthu 3.753e-02 3.383e-02
## jobunknown:day_of_weekthu -1.487e-01 7.389e-02
## jobblue-collar:day_of_weektue -3.735e-02 1.921e-02
## jobentrepreneur:day_of_weektue -7.519e-04 3.068e-02
## jobhousemaid:day_of_weektue -3.103e-02 3.686e-02
## jobmanagement:day_of_weektue -1.825e-02 2.230e-02
## jobretired:day_of_weektue -3.963e-03 3.100e-02
## jobself-employed:day_of_weektue -3.388e-02 3.051e-02
## jobservices:day_of_weektue -2.813e-02 2.059e-02
## jobstudent:day_of_weektue -5.013e-02 3.954e-02
## jobtechnician:day_of_weektue -2.874e-02 1.842e-02
## jobunemployed:day_of_weektue -1.809e-02 3.440e-02
## jobunknown:day_of_weektue -1.275e-01 7.174e-02
## jobblue-collar:day_of_weekwed -2.841e-02 1.920e-02
## jobentrepreneur:day_of_weekwed -1.134e-02 3.022e-02
## jobhousemaid:day_of_weekwed 1.214e-02 3.650e-02
## jobmanagement:day_of_weekwed -2.675e-02 2.236e-02
## jobretired:day_of_weekwed -3.376e-03 3.154e-02
## jobself-employed:day_of_weekwed 1.084e-02 3.119e-02
## jobservices:day_of_weekwed -4.003e-02 2.108e-02
## jobstudent:day_of_weekwed 7.103e-03 3.991e-02
## jobtechnician:day_of_weekwed -3.611e-02 1.861e-02
## jobunemployed:day_of_weekwed 8.778e-03 3.489e-02
## jobunknown:day_of_weekwed -1.614e-01 7.411e-02
## maritalmarried:educationbasic.6y -1.789e-02 3.140e-02
## maritalsingle:educationbasic.6y 1.463e-02 3.945e-02
## maritalunknown:educationbasic.6y -2.344e-01 3.141e-01
## maritalmarried:educationbasic.9y 9.886e-03 2.343e-02
## maritalsingle:educationbasic.9y 2.942e-02 2.968e-02
## maritalunknown:educationbasic.9y 1.087e-01 2.744e-01
## maritalmarried:educationhigh.school -3.266e-02 2.325e-02
## maritalsingle:educationhigh.school 3.107e-03 2.956e-02
## maritalunknown:educationhigh.school -3.446e-01 2.967e-01
## maritalmarried:educationilliterate -2.176e+00 2.755e+00
## maritalsingle:educationilliterate -2.000e+00 2.733e+00
## maritalunknown:educationilliterate NA NA
## maritalmarried:educationprofessional.course 1.217e-03 2.561e-02
## maritalsingle:educationprofessional.course 1.098e-02 3.250e-02
## maritalunknown:educationprofessional.course -2.251e-01 3.158e-01
## maritalmarried:educationuniversity.degree -1.781e-02 2.392e-02
## maritalsingle:educationuniversity.degree 5.004e-03 3.023e-02
## maritalunknown:educationuniversity.degree -2.307e-01 2.991e-01
## maritalmarried:educationunknown 8.363e-03 3.297e-02
## maritalsingle:educationunknown 9.112e-02 4.107e-02
## maritalunknown:educationunknown -1.283e-01 2.771e-01
## maritalmarried:defaultunknown -1.058e-02 1.411e-02
## maritalsingle:defaultunknown -2.834e-03 1.707e-02
## maritalunknown:defaultunknown -2.120e-01 1.967e-01
## maritalmarried:defaultyes NA NA
## maritalsingle:defaultyes NA NA
## maritalunknown:defaultyes NA NA
## maritalmarried:housingunknown 3.012e-02 3.420e-02
## maritalsingle:housingunknown 4.775e-02 3.895e-02
## maritalunknown:housingunknown -4.836e-01 3.602e-01
## maritalmarried:housingyes 1.209e-02 1.073e-02
## maritalsingle:housingyes 1.007e-02 1.232e-02
## maritalunknown:housingyes -1.039e-01 1.208e-01
## maritalmarried:loanunknown NA NA
## maritalsingle:loanunknown NA NA
## maritalunknown:loanunknown NA NA
## maritalmarried:loanyes -6.964e-03 1.492e-02
## maritalsingle:loanyes 9.822e-03 1.701e-02
## maritalunknown:loanyes 2.626e-02 1.436e-01
## maritalmarried:contacttelephone -2.264e-02 1.442e-02
## maritalsingle:contacttelephone -2.992e-02 1.620e-02
## maritalunknown:contacttelephone -8.737e-02 1.524e-01
## maritalmarried:monthaug -4.816e-02 2.574e-02
## maritalsingle:monthaug -4.929e-02 2.936e-02
## maritalunknown:monthaug 5.731e-01 3.206e-01
## maritalmarried:monthdec 2.795e-01 1.063e-01
## maritalsingle:monthdec 2.640e-01 1.339e-01
## maritalunknown:monthdec NA NA
## maritalmarried:monthjul -1.225e-02 2.386e-02
## maritalsingle:monthjul -3.335e-02 2.745e-02
## maritalunknown:monthjul 3.973e-01 4.699e-01
## maritalmarried:monthjun 2.668e-02 2.777e-02
## maritalsingle:monthjun 1.952e-02 3.175e-02
## maritalunknown:monthjun 3.201e-01 2.858e-01
## maritalmarried:monthmar -2.310e-01 6.071e-02
## maritalsingle:monthmar -1.811e-01 6.572e-02
## maritalunknown:monthmar 2.264e-01 3.443e-01
## maritalmarried:monthmay 1.012e-02 2.383e-02
## maritalsingle:monthmay 7.287e-04 2.714e-02
## maritalunknown:monthmay 3.632e-01 2.575e-01
## maritalmarried:monthnov -3.653e-02 2.573e-02
## maritalsingle:monthnov -2.540e-02 2.988e-02
## maritalunknown:monthnov 5.857e-01 3.730e-01
## maritalmarried:monthoct 5.833e-02 5.115e-02
## maritalsingle:monthoct -2.841e-02 6.009e-02
## maritalunknown:monthoct -3.825e-01 4.447e-01
## maritalmarried:monthsep -1.384e-02 6.061e-02
## maritalsingle:monthsep -8.665e-03 7.025e-02
## maritalunknown:monthsep NA NA
## maritalmarried:day_of_weekmon -1.152e-04 1.664e-02
## maritalsingle:day_of_weekmon -1.173e-02 1.921e-02
## maritalunknown:day_of_weekmon -5.286e-02 2.269e-01
## maritalmarried:day_of_weekthu 1.098e-02 1.700e-02
## maritalsingle:day_of_weekthu 2.105e-02 1.941e-02
## maritalunknown:day_of_weekthu -1.268e-01 1.671e-01
## maritalmarried:day_of_weektue 9.957e-03 1.689e-02
## maritalsingle:day_of_weektue 3.908e-03 1.945e-02
## maritalunknown:day_of_weektue -8.245e-02 1.857e-01
## maritalmarried:day_of_weekwed 1.224e-02 1.727e-02
## maritalsingle:day_of_weekwed 7.710e-03 1.978e-02
## maritalunknown:day_of_weekwed 5.248e-02 2.171e-01
## educationbasic.6y:defaultunknown 1.264e-02 1.823e-02
## educationbasic.9y:defaultunknown -1.666e-03 1.500e-02
## educationhigh.school:defaultunknown 1.257e-03 1.648e-02
## educationilliterate:defaultunknown -1.352e-01 4.173e-01
## educationprofessional.course:defaultunknown -7.322e-03 1.956e-02
## educationuniversity.degree:defaultunknown -1.385e-03 1.737e-02
## educationunknown:defaultunknown -3.865e-02 2.233e-02
## educationbasic.6y:defaultyes NA NA
## educationbasic.9y:defaultyes NA NA
## educationhigh.school:defaultyes NA NA
## educationilliterate:defaultyes NA NA
## educationprofessional.course:defaultyes NA NA
## educationuniversity.degree:defaultyes NA NA
## educationunknown:defaultyes NA NA
## educationbasic.6y:housingunknown 2.220e-02 5.412e-02
## educationbasic.9y:housingunknown -2.148e-02 4.303e-02
## educationhigh.school:housingunknown -4.452e-02 4.538e-02
## educationilliterate:housingunknown NA NA
## educationprofessional.course:housingunknown -3.586e-02 5.143e-02
## educationuniversity.degree:housingunknown -6.810e-02 4.649e-02
## educationunknown:housingunknown -2.375e-02 6.415e-02
## educationbasic.6y:housingyes -7.284e-03 1.740e-02
## educationbasic.9y:housingyes -1.105e-02 1.380e-02
## educationhigh.school:housingyes -4.809e-03 1.432e-02
## educationilliterate:housingyes 4.583e-01 2.846e-01
## educationprofessional.course:housingyes -4.350e-03 1.604e-02
## educationuniversity.degree:housingyes -2.621e-02 1.463e-02
## educationunknown:housingyes -6.579e-03 2.004e-02
## educationbasic.6y:loanunknown NA NA
## educationbasic.9y:loanunknown NA NA
## educationhigh.school:loanunknown NA NA
## educationilliterate:loanunknown NA NA
## educationprofessional.course:loanunknown NA NA
## educationuniversity.degree:loanunknown NA NA
## educationunknown:loanunknown NA NA
## educationbasic.6y:loanyes -2.333e-02 2.427e-02
## educationbasic.9y:loanyes -1.424e-02 1.927e-02
## educationhigh.school:loanyes -3.239e-02 1.976e-02
## educationilliterate:loanyes NA NA
## educationprofessional.course:loanyes -3.702e-02 2.198e-02
## educationuniversity.degree:loanyes -4.620e-02 2.011e-02
## educationunknown:loanyes -1.742e-02 2.800e-02
## educationbasic.6y:contacttelephone 1.658e-04 2.212e-02
## educationbasic.9y:contacttelephone 1.405e-02 1.797e-02
## educationhigh.school:contacttelephone 3.617e-02 1.871e-02
## educationilliterate:contacttelephone 1.025e+00 4.036e-01
## educationprofessional.course:contacttelephone 3.043e-02 2.123e-02
## educationuniversity.degree:contacttelephone 1.982e-02 1.929e-02
## educationunknown:contacttelephone 2.075e-02 2.708e-02
## educationbasic.6y:monthaug 4.716e-02 4.879e-02
## educationbasic.9y:monthaug 7.130e-02 3.677e-02
## educationhigh.school:monthaug -1.926e-02 3.658e-02
## educationilliterate:monthaug 9.134e-01 8.059e-01
## educationprofessional.course:monthaug -4.360e-02 3.955e-02
## educationuniversity.degree:monthaug -1.307e-01 3.639e-02
## educationunknown:monthaug -4.705e-02 4.851e-02
## educationbasic.6y:monthdec NA NA
## educationbasic.9y:monthdec -8.128e-02 1.354e-01
## educationhigh.school:monthdec 8.751e-04 1.165e-01
## educationilliterate:monthdec NA NA
## educationprofessional.course:monthdec 4.791e-02 1.223e-01
## educationuniversity.degree:monthdec -7.885e-02 1.098e-01
## educationunknown:monthdec -2.211e-01 1.561e-01
## educationbasic.6y:monthjul -1.843e-03 4.218e-02
## educationbasic.9y:monthjul 3.724e-02 3.264e-02
## educationhigh.school:monthjul -4.725e-02 3.368e-02
## educationilliterate:monthjul NA NA
## educationprofessional.course:monthjul -2.141e-02 3.770e-02
## educationuniversity.degree:monthjul -1.099e-01 3.408e-02
## educationunknown:monthjul -5.817e-02 4.493e-02
## educationbasic.6y:monthjun 1.378e-02 4.695e-02
## educationbasic.9y:monthjun 3.977e-02 3.647e-02
## educationhigh.school:monthjun -5.558e-02 3.751e-02
## educationilliterate:monthjun NA NA
## educationprofessional.course:monthjun -5.845e-02 4.184e-02
## educationuniversity.degree:monthjun -1.120e-01 3.801e-02
## educationunknown:monthjun -6.956e-02 5.065e-02
## educationbasic.6y:monthmar 3.875e-01 1.263e-01
## educationbasic.9y:monthmar 2.282e-01 9.097e-02
## educationhigh.school:monthmar 2.834e-01 8.155e-02
## educationilliterate:monthmar NA NA
## educationprofessional.course:monthmar 2.102e-01 8.682e-02
## educationuniversity.degree:monthmar 1.594e-01 7.936e-02
## educationunknown:monthmar 1.955e-01 9.481e-02
## educationbasic.6y:monthmay 6.729e-03 4.119e-02
## educationbasic.9y:monthmay 2.829e-02 3.194e-02
## educationhigh.school:monthmay -6.902e-02 3.317e-02
## educationilliterate:monthmay NA NA
## educationprofessional.course:monthmay -6.355e-02 3.714e-02
## educationuniversity.degree:monthmay -1.229e-01 3.362e-02
## educationunknown:monthmay -1.004e-01 4.577e-02
## educationbasic.6y:monthnov 3.451e-03 4.928e-02
## educationbasic.9y:monthnov 1.823e-02 3.687e-02
## educationhigh.school:monthnov -4.190e-02 3.738e-02
## educationilliterate:monthnov NA NA
## educationprofessional.course:monthnov -4.241e-02 4.105e-02
## educationuniversity.degree:monthnov -1.017e-01 3.710e-02
## educationunknown:monthnov -2.060e-02 5.364e-02
## educationbasic.6y:monthoct 7.349e-02 9.402e-02
## educationbasic.9y:monthoct 6.353e-02 7.239e-02
## educationhigh.school:monthoct 2.224e-01 5.970e-02
## educationilliterate:monthoct NA NA
## educationprofessional.course:monthoct 3.938e-03 6.337e-02
## educationuniversity.degree:monthoct -3.787e-03 5.892e-02
## educationunknown:monthoct -2.575e-01 8.373e-02
## educationbasic.6y:monthsep -1.221e-01 1.151e-01
## educationbasic.9y:monthsep -1.394e-01 9.692e-02
## educationhigh.school:monthsep -1.393e-01 7.759e-02
## educationilliterate:monthsep NA NA
## educationprofessional.course:monthsep -1.829e-01 8.050e-02
## educationuniversity.degree:monthsep -2.668e-01 7.657e-02
## educationunknown:monthsep -2.246e-01 9.477e-02
## educationbasic.6y:day_of_weekmon 1.671e-02 2.804e-02
## educationbasic.9y:day_of_weekmon -1.359e-02 2.191e-02
## educationhigh.school:day_of_weekmon 4.703e-04 2.272e-02
## educationilliterate:day_of_weekmon NA NA
## educationprofessional.course:day_of_weekmon -7.196e-04 2.556e-02
## educationuniversity.degree:day_of_weekmon -1.328e-02 2.331e-02
## educationunknown:day_of_weekmon 9.832e-03 3.109e-02
## educationbasic.6y:day_of_weekthu 6.644e-03 2.749e-02
## educationbasic.9y:day_of_weekthu 1.234e-02 2.173e-02
## educationhigh.school:day_of_weekthu 1.091e-03 2.280e-02
## educationilliterate:day_of_weekthu NA NA
## educationprofessional.course:day_of_weekthu 1.534e-02 2.536e-02
## educationuniversity.degree:day_of_weekthu -1.726e-03 2.321e-02
## educationunknown:day_of_weekthu 8.771e-03 3.054e-02
## educationbasic.6y:day_of_weektue -1.967e-03 2.765e-02
## educationbasic.9y:day_of_weektue -2.612e-02 2.192e-02
## educationhigh.school:day_of_weektue -3.851e-02 2.256e-02
## educationilliterate:day_of_weektue NA NA
## educationprofessional.course:day_of_weektue -5.432e-03 2.538e-02
## educationuniversity.degree:day_of_weektue -3.276e-02 2.316e-02
## educationunknown:day_of_weektue 1.878e-02 3.090e-02
## educationbasic.6y:day_of_weekwed 1.023e-02 2.734e-02
## educationbasic.9y:day_of_weekwed -2.283e-02 2.188e-02
## educationhigh.school:day_of_weekwed 2.419e-03 2.279e-02
## educationilliterate:day_of_weekwed NA NA
## educationprofessional.course:day_of_weekwed 6.545e-04 2.592e-02
## educationuniversity.degree:day_of_weekwed -2.320e-02 2.349e-02
## educationunknown:day_of_weekwed 2.401e-02 3.245e-02
## defaultunknown:housingunknown -3.591e-03 2.709e-02
## defaultyes:housingunknown NA NA
## defaultunknown:housingyes -9.544e-03 8.492e-03
## defaultyes:housingyes -3.504e-02 4.020e-01
## defaultunknown:loanunknown NA NA
## defaultyes:loanunknown NA NA
## defaultunknown:loanyes -7.345e-03 1.175e-02
## defaultyes:loanyes NA NA
## defaultunknown:contacttelephone 4.209e-02 1.207e-02
## defaultyes:contacttelephone NA NA
## defaultunknown:monthaug 3.709e-02 2.286e-02
## defaultyes:monthaug NA NA
## defaultunknown:monthdec 7.488e-01 3.134e-01
## defaultyes:monthdec NA NA
## defaultunknown:monthjul 5.191e-02 2.196e-02
## defaultyes:monthjul NA NA
## defaultunknown:monthjun 4.508e-02 2.492e-02
## defaultyes:monthjun NA NA
## defaultunknown:monthmar 2.800e-02 9.243e-02
## defaultyes:monthmar NA NA
## defaultunknown:monthmay 5.267e-02 2.224e-02
## defaultyes:monthmay NA NA
## defaultunknown:monthnov 5.804e-02 2.593e-02
## defaultyes:monthnov NA NA
## defaultunknown:monthoct 4.088e-01 9.228e-02
## defaultyes:monthoct NA NA
## defaultunknown:monthsep 2.131e-01 1.428e-01
## defaultyes:monthsep NA NA
## defaultunknown:day_of_weekmon -7.270e-03 1.321e-02
## defaultyes:day_of_weekmon NA NA
## defaultunknown:day_of_weekthu -1.424e-02 1.332e-02
## defaultyes:day_of_weekthu NA NA
## defaultunknown:day_of_weektue -8.168e-03 1.347e-02
## defaultyes:day_of_weektue NA NA
## defaultunknown:day_of_weekwed -1.652e-02 1.364e-02
## defaultyes:day_of_weekwed NA NA
## housingunknown:loanunknown NA NA
## housingyes:loanunknown NA NA
## housingunknown:loanyes NA NA
## housingyes:loanyes -1.180e-02 9.047e-03
## housingunknown:contacttelephone 3.341e-02 2.807e-02
## housingyes:contacttelephone 6.498e-03 8.599e-03
## housingunknown:monthaug -1.642e-02 5.315e-02
## housingyes:monthaug -1.470e-02 1.575e-02
## housingunknown:monthdec -5.147e-02 1.379e-01
## housingyes:monthdec -9.181e-02 5.914e-02
## housingunknown:monthjul -6.899e-02 5.294e-02
## housingyes:monthjul -2.764e-02 1.529e-02
## housingunknown:monthjun -1.304e-01 5.558e-02
## housingyes:monthjun -4.154e-02 1.721e-02
## housingunknown:monthmar -1.092e-01 1.222e-01
## housingyes:monthmar -1.016e-01 3.242e-02
## housingunknown:monthmay -7.732e-02 5.136e-02
## housingyes:monthmay -2.141e-02 1.502e-02
## housingunknown:monthnov -7.742e-02 5.782e-02
## housingyes:monthnov -1.921e-02 1.679e-02
## housingunknown:monthoct 5.458e-02 9.159e-02
## housingyes:monthoct -5.095e-02 2.804e-02
## housingunknown:monthsep -2.452e-02 1.052e-01
## housingyes:monthsep -1.598e-01 3.258e-02
## housingunknown:day_of_weekmon 2.884e-02 3.356e-02
## housingyes:day_of_weekmon 1.694e-03 1.034e-02
## housingunknown:day_of_weekthu 3.263e-02 3.388e-02
## housingyes:day_of_weekthu -5.144e-03 1.033e-02
## housingunknown:day_of_weektue 4.157e-02 3.324e-02
## housingyes:day_of_weektue -1.149e-03 1.044e-02
## housingunknown:day_of_weekwed 1.508e-02 3.323e-02
## housingyes:day_of_weekwed -4.292e-04 1.047e-02
## loanunknown:contacttelephone NA NA
## loanyes:contacttelephone 6.740e-03 1.165e-02
## loanunknown:monthaug NA NA
## loanyes:monthaug -2.000e-02 2.144e-02
## loanunknown:monthdec NA NA
## loanyes:monthdec 2.513e-02 7.235e-02
## loanunknown:monthjul NA NA
## loanyes:monthjul -1.857e-02 2.061e-02
## loanunknown:monthjun NA NA
## loanyes:monthjun -1.885e-02 2.348e-02
## loanunknown:monthmar NA NA
## loanyes:monthmar -1.345e-01 4.493e-02
## loanunknown:monthmay NA NA
## loanyes:monthmay -1.514e-02 2.024e-02
## loanunknown:monthnov NA NA
## loanyes:monthnov -9.327e-03 2.279e-02
## loanunknown:monthoct NA NA
## loanyes:monthoct -4.783e-02 4.218e-02
## loanunknown:monthsep NA NA
## loanyes:monthsep 7.778e-02 4.337e-02
## loanunknown:day_of_weekmon NA NA
## loanyes:day_of_weekmon 6.792e-03 1.395e-02
## loanunknown:day_of_weekthu NA NA
## loanyes:day_of_weekthu 1.232e-02 1.399e-02
## loanunknown:day_of_weektue NA NA
## loanyes:day_of_weektue 7.131e-03 1.433e-02
## loanunknown:day_of_weekwed NA NA
## loanyes:day_of_weekwed 6.417e-03 1.423e-02
## contacttelephone:monthaug 2.071e-02 3.252e-02
## contacttelephone:monthdec -1.416e-01 7.448e-02
## contacttelephone:monthjul -2.584e-02 2.729e-02
## contacttelephone:monthjun -3.348e-01 2.839e-02
## contacttelephone:monthmar -4.637e-02 5.267e-02
## contacttelephone:monthmay -5.761e-02 2.580e-02
## contacttelephone:monthnov 5.428e-02 3.022e-02
## contacttelephone:monthoct -1.698e-02 3.947e-02
## contacttelephone:monthsep -2.379e-01 4.683e-02
## contacttelephone:day_of_weekmon -9.646e-03 1.356e-02
## contacttelephone:day_of_weekthu -6.052e-03 1.368e-02
## contacttelephone:day_of_weektue 8.467e-03 1.357e-02
## contacttelephone:day_of_weekwed -5.102e-03 1.358e-02
## monthaug:day_of_weekmon -4.560e-02 2.291e-02
## monthdec:day_of_weekmon 2.882e-02 8.619e-02
## monthjul:day_of_weekmon -4.470e-02 2.246e-02
## monthjun:day_of_weekmon -1.393e-02 2.494e-02
## monthmar:day_of_weekmon -1.184e-01 4.985e-02
## monthmay:day_of_weekmon -9.558e-03 2.138e-02
## monthnov:day_of_weekmon -3.499e-02 2.483e-02
## monthoct:day_of_weekmon -1.891e-01 4.443e-02
## monthsep:day_of_weekmon -5.828e-02 5.316e-02
## monthaug:day_of_weekthu -1.936e-01 2.264e-02
## monthdec:day_of_weekthu -1.606e-02 9.495e-02
## monthjul:day_of_weekthu -1.926e-01 2.220e-02
## monthjun:day_of_weekthu -1.689e-01 2.543e-02
## monthmar:day_of_weekthu -3.103e-01 5.214e-02
## monthmay:day_of_weekthu -1.744e-01 2.132e-02
## monthnov:day_of_weekthu -1.811e-01 2.431e-02
## monthoct:day_of_weekthu -2.085e-01 4.298e-02
## monthsep:day_of_weekthu -1.089e-01 4.857e-02
## monthaug:day_of_weektue -1.692e-01 2.833e-02
## monthdec:day_of_weektue 1.459e-01 1.055e-01
## monthjul:day_of_weektue -1.847e-01 2.814e-02
## monthjun:day_of_weektue -1.902e-01 3.029e-02
## monthmar:day_of_weektue -5.525e-02 5.211e-02
## monthmay:day_of_weektue -1.839e-01 2.727e-02
## monthnov:day_of_weektue -1.545e-01 2.989e-02
## monthoct:day_of_weektue -1.609e-01 4.671e-02
## monthsep:day_of_weektue -4.603e-02 5.190e-02
## monthaug:day_of_weekwed -1.386e-01 2.712e-02
## monthdec:day_of_weekwed 3.768e-02 1.038e-01
## monthjul:day_of_weekwed -1.526e-01 2.684e-02
## monthjun:day_of_weekwed -1.168e-01 2.921e-02
## monthmar:day_of_weekwed -5.571e-02 6.075e-02
## monthmay:day_of_weekwed -1.390e-01 2.590e-02
## monthnov:day_of_weekwed -1.365e-01 2.867e-02
## monthoct:day_of_weekwed -1.565e-01 4.654e-02
## monthsep:day_of_weekwed 1.519e-03 5.225e-02
## t value Pr(>|t|)
## (Intercept) -1.560 0.118877
## age 1.940 0.052368 .
## jobblue-collar 1.820 0.068759 .
## jobentrepreneur -0.064 0.949313
## jobhousemaid 0.615 0.538852
## jobmanagement -1.195 0.231960
## jobretired -5.289 1.24e-07 ***
## jobself-employed 1.597 0.110295
## jobservices 0.487 0.626069
## jobstudent 1.577 0.114706
## jobtechnician 1.805 0.071029 .
## jobunemployed 1.335 0.181805
## jobunknown 0.672 0.501766
## maritalmarried 1.410 0.158667
## maritalsingle 2.573 0.010081 *
## maritalunknown 0.005 0.996099
## educationbasic.6y 1.214 0.224732
## educationbasic.9y 1.263 0.206719
## educationhigh.school 2.396 0.016571 *
## educationilliterate -0.659 0.509758
## educationprofessional.course 2.436 0.014870 *
## educationuniversity.degree 4.196 2.72e-05 ***
## educationunknown 1.320 0.187008
## defaultunknown -1.182 0.237135
## defaultyes -0.086 0.931590
## housingunknown -0.480 0.630948
## housingyes -0.763 0.445400
## loanunknown NA NA
## loanyes -0.275 0.783500
## contacttelephone 0.229 0.818492
## monthaug 1.241 0.214592
## monthdec 0.924 0.355666
## monthjul 1.007 0.313968
## monthjun 3.895 9.83e-05 ***
## monthmar 2.724 0.006455 **
## monthmay -0.142 0.887323
## monthnov 1.257 0.208797
## monthoct 4.096 4.22e-05 ***
## monthsep 5.455 4.93e-08 ***
## day_of_weekmon 0.500 0.616762
## day_of_weekthu 3.198 0.001385 **
## day_of_weektue 4.662 3.15e-06 ***
## day_of_weekwed 3.300 0.000969 ***
## age:jobblue-collar -2.055 0.039882 *
## age:jobentrepreneur -1.990 0.046603 *
## age:jobhousemaid 1.662 0.096442 .
## age:jobmanagement 0.423 0.672626
## age:jobretired 9.650 < 2e-16 ***
## age:jobself-employed -1.470 0.141497
## age:jobservices -2.837 0.004562 **
## age:jobstudent -2.027 0.042702 *
## age:jobtechnician -0.847 0.396908
## age:jobunemployed -1.705 0.088244 .
## age:jobunknown -0.035 0.971972
## age:maritalmarried -0.757 0.448929
## age:maritalsingle -3.750 0.000177 ***
## age:maritalunknown -0.231 0.816994
## age:educationbasic.6y -2.432 0.015027 *
## age:educationbasic.9y -2.738 0.006181 **
## age:educationhigh.school -1.636 0.101827
## age:educationilliterate 0.864 0.387710
## age:educationprofessional.course -2.612 0.008993 **
## age:educationuniversity.degree -2.690 0.007140 **
## age:educationunknown 0.112 0.911131
## age:defaultunknown -1.876 0.060670 .
## age:defaultyes 0.008 0.993710
## age:housingunknown 1.748 0.080416 .
## age:housingyes 3.337 0.000847 ***
## age:loanunknown NA NA
## age:loanyes 1.930 0.053561 .
## age:contacttelephone -2.095 0.036192 *
## age:monthaug 0.240 0.810028
## age:monthdec -1.170 0.242091
## age:monthjul 0.346 0.729318
## age:monthjun 1.165 0.243847
## age:monthmar 0.801 0.423039
## age:monthmay 1.841 0.065564 .
## age:monthnov -0.777 0.437410
## age:monthoct -3.436 0.000590 ***
## age:monthsep -2.815 0.004884 **
## age:day_of_weekmon 0.665 0.506195
## age:day_of_weekthu 1.614 0.106431
## age:day_of_weektue -0.821 0.411688
## age:day_of_weekwed -0.002 0.998673
## jobblue-collar:maritalmarried -2.815 0.004883 **
## jobentrepreneur:maritalmarried -0.261 0.793746
## jobhousemaid:maritalmarried -0.058 0.953709
## jobmanagement:maritalmarried -1.547 0.121838
## jobretired:maritalmarried 0.137 0.891031
## jobself-employed:maritalmarried -2.033 0.042077 *
## jobservices:maritalmarried -0.619 0.535595
## jobstudent:maritalmarried -0.424 0.671821
## jobtechnician:maritalmarried -0.809 0.418652
## jobunemployed:maritalmarried 1.663 0.096241 .
## jobunknown:maritalmarried -1.433 0.151953
## jobblue-collar:maritalsingle -1.995 0.046000 *
## jobentrepreneur:maritalsingle 0.105 0.916574
## jobhousemaid:maritalsingle 1.042 0.297483
## jobmanagement:maritalsingle -1.120 0.262732
## jobretired:maritalsingle 1.084 0.278532
## jobself-employed:maritalsingle -2.477 0.013251 *
## jobservices:maritalsingle -0.765 0.444472
## jobstudent:maritalsingle -0.511 0.609517
## jobtechnician:maritalsingle -0.315 0.752415
## jobunemployed:maritalsingle 1.652 0.098559 .
## jobunknown:maritalsingle 0.078 0.937725
## jobblue-collar:maritalunknown 0.932 0.351537
## jobentrepreneur:maritalunknown 2.044 0.040939 *
## jobhousemaid:maritalunknown 0.221 0.825133
## jobmanagement:maritalunknown 0.078 0.937642
## jobretired:maritalunknown 0.272 0.785306
## jobself-employed:maritalunknown -0.435 0.663433
## jobservices:maritalunknown 0.619 0.536103
## jobstudent:maritalunknown -0.914 0.360699
## jobtechnician:maritalunknown 0.217 0.828068
## jobunemployed:maritalunknown -1.153 0.248974
## jobunknown:maritalunknown 0.847 0.397265
## jobblue-collar:educationbasic.6y 0.489 0.625057
## jobentrepreneur:educationbasic.6y 1.150 0.249989
## jobhousemaid:educationbasic.6y 0.711 0.477234
## jobmanagement:educationbasic.6y 1.156 0.247697
## jobretired:educationbasic.6y -0.756 0.449721
## jobself-employed:educationbasic.6y 0.469 0.639337
## jobservices:educationbasic.6y 1.068 0.285712
## jobstudent:educationbasic.6y -0.827 0.407968
## jobtechnician:educationbasic.6y -1.009 0.313209
## jobunemployed:educationbasic.6y -0.473 0.636527
## jobunknown:educationbasic.6y 0.891 0.373164
## jobblue-collar:educationbasic.9y -0.288 0.773393
## jobentrepreneur:educationbasic.9y -0.172 0.863448
## jobhousemaid:educationbasic.9y -0.534 0.593645
## jobmanagement:educationbasic.9y 0.386 0.699454
## jobretired:educationbasic.9y -1.355 0.175509
## jobself-employed:educationbasic.9y -0.327 0.743949
## jobservices:educationbasic.9y 0.370 0.711381
## jobstudent:educationbasic.9y -1.253 0.210206
## jobtechnician:educationbasic.9y -1.620 0.105178
## jobunemployed:educationbasic.9y -0.100 0.920456
## jobunknown:educationbasic.9y -0.577 0.563730
## jobblue-collar:educationhigh.school -0.036 0.971534
## jobentrepreneur:educationhigh.school -0.278 0.781211
## jobhousemaid:educationhigh.school -0.413 0.679637
## jobmanagement:educationhigh.school -0.043 0.965390
## jobretired:educationhigh.school -1.787 0.073972 .
## jobself-employed:educationhigh.school -0.490 0.624268
## jobservices:educationhigh.school 0.278 0.781141
## jobstudent:educationhigh.school -1.253 0.210133
## jobtechnician:educationhigh.school -2.381 0.017289 *
## jobunemployed:educationhigh.school -1.013 0.311231
## jobunknown:educationhigh.school 0.661 0.508606
## jobblue-collar:educationilliterate -1.546 0.122160
## jobentrepreneur:educationilliterate 0.086 0.931638
## jobhousemaid:educationilliterate -1.476 0.139922
## jobmanagement:educationilliterate NA NA
## jobretired:educationilliterate -0.968 0.333108
## jobself-employed:educationilliterate 0.288 0.773547
## jobservices:educationilliterate NA NA
## jobstudent:educationilliterate NA NA
## jobtechnician:educationilliterate NA NA
## jobunemployed:educationilliterate NA NA
## jobunknown:educationilliterate NA NA
## jobblue-collar:educationprofessional.course -0.435 0.663846
## jobentrepreneur:educationprofessional.course -0.791 0.428731
## jobhousemaid:educationprofessional.course 0.503 0.615160
## jobmanagement:educationprofessional.course 0.417 0.676751
## jobretired:educationprofessional.course -1.333 0.182450
## jobself-employed:educationprofessional.course -0.507 0.611932
## jobservices:educationprofessional.course 0.046 0.962951
## jobstudent:educationprofessional.course 0.359 0.719911
## jobtechnician:educationprofessional.course -2.085 0.037106 *
## jobunemployed:educationprofessional.course -0.888 0.374313
## jobunknown:educationprofessional.course -0.655 0.512457
## jobblue-collar:educationuniversity.degree -0.526 0.599040
## jobentrepreneur:educationuniversity.degree 0.206 0.837026
## jobhousemaid:educationuniversity.degree -0.285 0.775604
## jobmanagement:educationuniversity.degree 0.364 0.715528
## jobretired:educationuniversity.degree -1.791 0.073374 .
## jobself-employed:educationuniversity.degree -0.575 0.565415
## jobservices:educationuniversity.degree 0.680 0.496603
## jobstudent:educationuniversity.degree -1.621 0.105073
## jobtechnician:educationuniversity.degree -2.241 0.025005 *
## jobunemployed:educationuniversity.degree -1.384 0.166229
## jobunknown:educationuniversity.degree 0.607 0.543818
## jobblue-collar:educationunknown -1.559 0.118905
## jobentrepreneur:educationunknown -0.389 0.697129
## jobhousemaid:educationunknown -0.485 0.627692
## jobmanagement:educationunknown 0.274 0.783982
## jobretired:educationunknown -2.735 0.006234 **
## jobself-employed:educationunknown -0.428 0.668804
## jobservices:educationunknown 0.228 0.819683
## jobstudent:educationunknown -1.179 0.238260
## jobtechnician:educationunknown -2.233 0.025583 *
## jobunemployed:educationunknown -0.016 0.987224
## jobunknown:educationunknown 0.408 0.683186
## jobblue-collar:defaultunknown 2.105 0.035308 *
## jobentrepreneur:defaultunknown 1.620 0.105309
## jobhousemaid:defaultunknown -0.357 0.720927
## jobmanagement:defaultunknown 0.594 0.552554
## jobretired:defaultunknown -0.674 0.500191
## jobself-employed:defaultunknown 0.801 0.423100
## jobservices:defaultunknown 1.717 0.085966 .
## jobstudent:defaultunknown -2.118 0.034146 *
## jobtechnician:defaultunknown 1.589 0.112173
## jobunemployed:defaultunknown 0.449 0.653269
## jobunknown:defaultunknown 0.070 0.944479
## jobblue-collar:defaultyes NA NA
## jobentrepreneur:defaultyes NA NA
## jobhousemaid:defaultyes NA NA
## jobmanagement:defaultyes NA NA
## jobretired:defaultyes NA NA
## jobself-employed:defaultyes NA NA
## jobservices:defaultyes NA NA
## jobstudent:defaultyes NA NA
## jobtechnician:defaultyes NA NA
## jobunemployed:defaultyes NA NA
## jobunknown:defaultyes NA NA
## jobblue-collar:housingunknown -0.703 0.482196
## jobentrepreneur:housingunknown -0.031 0.974925
## jobhousemaid:housingunknown -1.204 0.228647
## jobmanagement:housingunknown -1.879 0.060200 .
## jobretired:housingunknown -1.385 0.166130
## jobself-employed:housingunknown -0.437 0.662380
## jobservices:housingunknown 0.062 0.950610
## jobstudent:housingunknown 2.933 0.003357 **
## jobtechnician:housingunknown 0.619 0.535765
## jobunemployed:housingunknown -1.197 0.231309
## jobunknown:housingunknown -0.741 0.458730
## jobblue-collar:housingyes -1.335 0.182004
## jobentrepreneur:housingyes 0.536 0.592257
## jobhousemaid:housingyes -1.082 0.279110
## jobmanagement:housingyes -0.112 0.911007
## jobretired:housingyes -0.392 0.695187
## jobself-employed:housingyes -1.615 0.106287
## jobservices:housingyes -0.819 0.412837
## jobstudent:housingyes 1.980 0.047673 *
## jobtechnician:housingyes 0.031 0.975306
## jobunemployed:housingyes -0.108 0.914294
## jobunknown:housingyes -0.743 0.457683
## jobblue-collar:loanunknown NA NA
## jobentrepreneur:loanunknown NA NA
## jobhousemaid:loanunknown NA NA
## jobmanagement:loanunknown NA NA
## jobretired:loanunknown NA NA
## jobself-employed:loanunknown NA NA
## jobservices:loanunknown NA NA
## jobstudent:loanunknown NA NA
## jobtechnician:loanunknown NA NA
## jobunemployed:loanunknown NA NA
## jobunknown:loanunknown NA NA
## jobblue-collar:loanyes -0.431 0.666113
## jobentrepreneur:loanyes 0.018 0.985413
## jobhousemaid:loanyes 0.358 0.720134
## jobmanagement:loanyes 1.366 0.171974
## jobretired:loanyes 0.241 0.809175
## jobself-employed:loanyes 1.348 0.177803
## jobservices:loanyes 1.478 0.139328
## jobstudent:loanyes 4.120 3.80e-05 ***
## jobtechnician:loanyes 0.805 0.421094
## jobunemployed:loanyes 1.033 0.301743
## jobunknown:loanyes -0.604 0.546074
## jobblue-collar:contacttelephone 1.658 0.097246 .
## jobentrepreneur:contacttelephone 1.256 0.209140
## jobhousemaid:contacttelephone 1.673 0.094373 .
## jobmanagement:contacttelephone 0.288 0.773664
## jobretired:contacttelephone -0.143 0.886356
## jobself-employed:contacttelephone -0.121 0.903760
## jobservices:contacttelephone 0.637 0.523843
## jobstudent:contacttelephone -1.742 0.081503 .
## jobtechnician:contacttelephone -1.409 0.158951
## jobunemployed:contacttelephone -2.308 0.021001 *
## jobunknown:contacttelephone 2.967 0.003012 **
## jobblue-collar:monthaug 0.756 0.449813
## jobentrepreneur:monthaug 2.143 0.032132 *
## jobhousemaid:monthaug -2.135 0.032775 *
## jobmanagement:monthaug 2.908 0.003640 **
## jobretired:monthaug -1.039 0.298939
## jobself-employed:monthaug 0.035 0.972314
## jobservices:monthaug 2.590 0.009606 **
## jobstudent:monthaug 4.631 3.66e-06 ***
## jobtechnician:monthaug 0.298 0.765615
## jobunemployed:monthaug -0.086 0.931631
## jobunknown:monthaug 0.479 0.631635
## jobblue-collar:monthdec -0.038 0.970001
## jobentrepreneur:monthdec NA NA
## jobhousemaid:monthdec -0.811 0.417588
## jobmanagement:monthdec -1.477 0.139720
## jobretired:monthdec -1.047 0.295123
## jobself-employed:monthdec 1.031 0.302666
## jobservices:monthdec 2.668 0.007633 **
## jobstudent:monthdec -1.531 0.125782
## jobtechnician:monthdec 3.293 0.000992 ***
## jobunemployed:monthdec 1.944 0.051855 .
## jobunknown:monthdec NA NA
## jobblue-collar:monthjul 0.412 0.680185
## jobentrepreneur:monthjul 1.289 0.197273
## jobhousemaid:monthjul -2.601 0.009310 **
## jobmanagement:monthjul 2.647 0.008115 **
## jobretired:monthjul -0.439 0.660702
## jobself-employed:monthjul 0.159 0.873504
## jobservices:monthjul 2.323 0.020170 *
## jobstudent:monthjul 3.261 0.001112 **
## jobtechnician:monthjul 0.179 0.857698
## jobunemployed:monthjul -1.294 0.195672
## jobunknown:monthjul 0.637 0.524428
## jobblue-collar:monthjun 0.989 0.322610
## jobentrepreneur:monthjun 1.786 0.074101 .
## jobhousemaid:monthjun -2.639 0.008310 **
## jobmanagement:monthjun 3.323 0.000891 ***
## jobretired:monthjun -1.222 0.221751
## jobself-employed:monthjun 0.745 0.456441
## jobservices:monthjun 1.767 0.077178 .
## jobstudent:monthjun 2.387 0.016983 *
## jobtechnician:monthjun 1.940 0.052376 .
## jobunemployed:monthjun 0.218 0.827322
## jobunknown:monthjun -0.158 0.874524
## jobblue-collar:monthmar 1.540 0.123649
## jobentrepreneur:monthmar 2.152 0.031376 *
## jobhousemaid:monthmar 0.785 0.432447
## jobmanagement:monthmar 0.602 0.547356
## jobretired:monthmar -2.259 0.023908 *
## jobself-employed:monthmar -0.963 0.335507
## jobservices:monthmar -1.226 0.220049
## jobstudent:monthmar 1.336 0.181590
## jobtechnician:monthmar 0.996 0.319314
## jobunemployed:monthmar 1.210 0.226219
## jobunknown:monthmar NA NA
## jobblue-collar:monthmay 0.388 0.698020
## jobentrepreneur:monthmay 1.327 0.184545
## jobhousemaid:monthmay -2.667 0.007649 **
## jobmanagement:monthmay 2.660 0.007828 **
## jobretired:monthmay -1.144 0.252691
## jobself-employed:monthmay 0.430 0.667481
## jobservices:monthmay 2.361 0.018238 *
## jobstudent:monthmay 2.824 0.004752 **
## jobtechnician:monthmay 1.819 0.068959 .
## jobunemployed:monthmay 0.070 0.944401
## jobunknown:monthmay -0.462 0.644298
## jobblue-collar:monthnov 0.985 0.324554
## jobentrepreneur:monthnov 1.067 0.286074
## jobhousemaid:monthnov -1.053 0.292439
## jobmanagement:monthnov 2.466 0.013678 *
## jobretired:monthnov 1.913 0.055710 .
## jobself-employed:monthnov -0.298 0.765450
## jobservices:monthnov 1.166 0.243567
## jobstudent:monthnov 3.578 0.000346 ***
## jobtechnician:monthnov 1.099 0.271651
## jobunemployed:monthnov -1.111 0.266540
## jobunknown:monthnov 2.870 0.004107 **
## jobblue-collar:monthoct 0.039 0.968945
## jobentrepreneur:monthoct 1.726 0.084334 .
## jobhousemaid:monthoct -0.533 0.594061
## jobmanagement:monthoct 4.468 7.91e-06 ***
## jobretired:monthoct -0.707 0.479355
## jobself-employed:monthoct 0.686 0.492949
## jobservices:monthoct 1.504 0.132497
## jobstudent:monthoct 0.743 0.457519
## jobtechnician:monthoct 3.471 0.000519 ***
## jobunemployed:monthoct -1.102 0.270564
## jobunknown:monthoct -1.330 0.183593
## jobblue-collar:monthsep -1.475 0.140262
## jobentrepreneur:monthsep 1.156 0.247738
## jobhousemaid:monthsep -2.631 0.008508 **
## jobmanagement:monthsep 1.964 0.049560 *
## jobretired:monthsep -3.081 0.002062 **
## jobself-employed:monthsep -1.143 0.253018
## jobservices:monthsep 0.473 0.636347
## jobstudent:monthsep -2.146 0.031867 *
## jobtechnician:monthsep 0.854 0.393112
## jobunemployed:monthsep -1.446 0.148085
## jobunknown:monthsep -0.807 0.419609
## jobblue-collar:day_of_weekmon -1.769 0.076944 .
## jobentrepreneur:day_of_weekmon 0.283 0.777369
## jobhousemaid:day_of_weekmon -0.738 0.460343
## jobmanagement:day_of_weekmon -0.645 0.518936
## jobretired:day_of_weekmon 0.038 0.969666
## jobself-employed:day_of_weekmon -0.342 0.732149
## jobservices:day_of_weekmon -1.693 0.090492 .
## jobstudent:day_of_weekmon -0.805 0.420718
## jobtechnician:day_of_weekmon -0.494 0.621453
## jobunemployed:day_of_weekmon 0.872 0.383190
## jobunknown:day_of_weekmon -1.974 0.048339 *
## jobblue-collar:day_of_weekthu -1.430 0.152699
## jobentrepreneur:day_of_weekthu -0.868 0.385267
## jobhousemaid:day_of_weekthu -0.484 0.628516
## jobmanagement:day_of_weekthu -1.514 0.130099
## jobretired:day_of_weekthu -1.322 0.186195
## jobself-employed:day_of_weekthu -0.663 0.507615
## jobservices:day_of_weekthu -1.551 0.120855
## jobstudent:day_of_weekthu -0.914 0.360500
## jobtechnician:day_of_weekthu -1.674 0.094182 .
## jobunemployed:day_of_weekthu 1.109 0.267277
## jobunknown:day_of_weekthu -2.012 0.044200 *
## jobblue-collar:day_of_weektue -1.945 0.051796 .
## jobentrepreneur:day_of_weektue -0.025 0.980450
## jobhousemaid:day_of_weektue -0.842 0.399842
## jobmanagement:day_of_weektue -0.818 0.413101
## jobretired:day_of_weektue -0.128 0.898291
## jobself-employed:day_of_weektue -1.110 0.266892
## jobservices:day_of_weektue -1.366 0.171815
## jobstudent:day_of_weektue -1.268 0.204900
## jobtechnician:day_of_weektue -1.560 0.118837
## jobunemployed:day_of_weektue -0.526 0.599005
## jobunknown:day_of_weektue -1.777 0.075507 .
## jobblue-collar:day_of_weekwed -1.480 0.138872
## jobentrepreneur:day_of_weekwed -0.375 0.707562
## jobhousemaid:day_of_weekwed 0.333 0.739421
## jobmanagement:day_of_weekwed -1.197 0.231419
## jobretired:day_of_weekwed -0.107 0.914763
## jobself-employed:day_of_weekwed 0.348 0.728137
## jobservices:day_of_weekwed -1.899 0.057599 .
## jobstudent:day_of_weekwed 0.178 0.858760
## jobtechnician:day_of_weekwed -1.941 0.052303 .
## jobunemployed:day_of_weekwed 0.252 0.801365
## jobunknown:day_of_weekwed -2.178 0.029387 *
## maritalmarried:educationbasic.6y -0.570 0.568847
## maritalsingle:educationbasic.6y 0.371 0.710731
## maritalunknown:educationbasic.6y -0.746 0.455375
## maritalmarried:educationbasic.9y 0.422 0.673051
## maritalsingle:educationbasic.9y 0.991 0.321688
## maritalunknown:educationbasic.9y 0.396 0.692075
## maritalmarried:educationhigh.school -1.405 0.160000
## maritalsingle:educationhigh.school 0.105 0.916298
## maritalunknown:educationhigh.school -1.161 0.245504
## maritalmarried:educationilliterate -0.790 0.429728
## maritalsingle:educationilliterate -0.732 0.464299
## maritalunknown:educationilliterate NA NA
## maritalmarried:educationprofessional.course 0.048 0.962110
## maritalsingle:educationprofessional.course 0.338 0.735427
## maritalunknown:educationprofessional.course -0.713 0.475990
## maritalmarried:educationuniversity.degree -0.745 0.456506
## maritalsingle:educationuniversity.degree 0.166 0.868520
## maritalunknown:educationuniversity.degree -0.771 0.440543
## maritalmarried:educationunknown 0.254 0.799793
## maritalsingle:educationunknown 2.219 0.026515 *
## maritalunknown:educationunknown -0.463 0.643311
## maritalmarried:defaultunknown -0.750 0.453224
## maritalsingle:defaultunknown -0.166 0.868134
## maritalunknown:defaultunknown -1.078 0.281063
## maritalmarried:defaultyes NA NA
## maritalsingle:defaultyes NA NA
## maritalunknown:defaultyes NA NA
## maritalmarried:housingunknown 0.881 0.378480
## maritalsingle:housingunknown 1.226 0.220184
## maritalunknown:housingunknown -1.342 0.179487
## maritalmarried:housingyes 1.126 0.259982
## maritalsingle:housingyes 0.818 0.413495
## maritalunknown:housingyes -0.860 0.390044
## maritalmarried:loanunknown NA NA
## maritalsingle:loanunknown NA NA
## maritalunknown:loanunknown NA NA
## maritalmarried:loanyes -0.467 0.640574
## maritalsingle:loanyes 0.577 0.563682
## maritalunknown:loanyes 0.183 0.854934
## maritalmarried:contacttelephone -1.570 0.116378
## maritalsingle:contacttelephone -1.847 0.064728 .
## maritalunknown:contacttelephone -0.573 0.566387
## maritalmarried:monthaug -1.871 0.061294 .
## maritalsingle:monthaug -1.678 0.093279 .
## maritalunknown:monthaug 1.788 0.073837 .
## maritalmarried:monthdec 2.628 0.008583 **
## maritalsingle:monthdec 1.972 0.048661 *
## maritalunknown:monthdec NA NA
## maritalmarried:monthjul -0.513 0.607708
## maritalsingle:monthjul -1.215 0.224370
## maritalunknown:monthjul 0.846 0.397825
## maritalmarried:monthjun 0.961 0.336601
## maritalsingle:monthjun 0.615 0.538736
## maritalunknown:monthjun 1.120 0.262658
## maritalmarried:monthmar -3.805 0.000142 ***
## maritalsingle:monthmar -2.756 0.005846 **
## maritalunknown:monthmar 0.658 0.510742
## maritalmarried:monthmay 0.424 0.671208
## maritalsingle:monthmay 0.027 0.978579
## maritalunknown:monthmay 1.410 0.158460
## maritalmarried:monthnov -1.419 0.155769
## maritalsingle:monthnov -0.850 0.395380
## maritalunknown:monthnov 1.570 0.116369
## maritalmarried:monthoct 1.140 0.254158
## maritalsingle:monthoct -0.473 0.636404
## maritalunknown:monthoct -0.860 0.389735
## maritalmarried:monthsep -0.228 0.819346
## maritalsingle:monthsep -0.123 0.901833
## maritalunknown:monthsep NA NA
## maritalmarried:day_of_weekmon -0.007 0.994476
## maritalsingle:day_of_weekmon -0.611 0.541385
## maritalunknown:day_of_weekmon -0.233 0.815819
## maritalmarried:day_of_weekthu 0.646 0.518449
## maritalsingle:day_of_weekthu 1.085 0.278133
## maritalunknown:day_of_weekthu -0.759 0.447855
## maritalmarried:day_of_weektue 0.590 0.555461
## maritalsingle:day_of_weektue 0.201 0.840728
## maritalunknown:day_of_weektue -0.444 0.657134
## maritalmarried:day_of_weekwed 0.709 0.478552
## maritalsingle:day_of_weekwed 0.390 0.696737
## maritalunknown:day_of_weekwed 0.242 0.808986
## educationbasic.6y:defaultunknown 0.693 0.488284
## educationbasic.9y:defaultunknown -0.111 0.911568
## educationhigh.school:defaultunknown 0.076 0.939215
## educationilliterate:defaultunknown -0.324 0.745937
## educationprofessional.course:defaultunknown -0.374 0.708220
## educationuniversity.degree:defaultunknown -0.080 0.936432
## educationunknown:defaultunknown -1.730 0.083558 .
## educationbasic.6y:defaultyes NA NA
## educationbasic.9y:defaultyes NA NA
## educationhigh.school:defaultyes NA NA
## educationilliterate:defaultyes NA NA
## educationprofessional.course:defaultyes NA NA
## educationuniversity.degree:defaultyes NA NA
## educationunknown:defaultyes NA NA
## educationbasic.6y:housingunknown 0.410 0.681739
## educationbasic.9y:housingunknown -0.499 0.617649
## educationhigh.school:housingunknown -0.981 0.326515
## educationilliterate:housingunknown NA NA
## educationprofessional.course:housingunknown -0.697 0.485605
## educationuniversity.degree:housingunknown -1.465 0.142983
## educationunknown:housingunknown -0.370 0.711164
## educationbasic.6y:housingyes -0.419 0.675560
## educationbasic.9y:housingyes -0.801 0.423182
## educationhigh.school:housingyes -0.336 0.736954
## educationilliterate:housingyes 1.611 0.107279
## educationprofessional.course:housingyes -0.271 0.786197
## educationuniversity.degree:housingyes -1.791 0.073287 .
## educationunknown:housingyes -0.328 0.742646
## educationbasic.6y:loanunknown NA NA
## educationbasic.9y:loanunknown NA NA
## educationhigh.school:loanunknown NA NA
## educationilliterate:loanunknown NA NA
## educationprofessional.course:loanunknown NA NA
## educationuniversity.degree:loanunknown NA NA
## educationunknown:loanunknown NA NA
## educationbasic.6y:loanyes -0.961 0.336507
## educationbasic.9y:loanyes -0.739 0.459926
## educationhigh.school:loanyes -1.639 0.101163
## educationilliterate:loanyes NA NA
## educationprofessional.course:loanyes -1.684 0.092150 .
## educationuniversity.degree:loanyes -2.297 0.021627 *
## educationunknown:loanyes -0.622 0.533814
## educationbasic.6y:contacttelephone 0.007 0.994021
## educationbasic.9y:contacttelephone 0.782 0.434418
## educationhigh.school:contacttelephone 1.933 0.053290 .
## educationilliterate:contacttelephone 2.540 0.011091 *
## educationprofessional.course:contacttelephone 1.433 0.151738
## educationuniversity.degree:contacttelephone 1.027 0.304293
## educationunknown:contacttelephone 0.766 0.443595
## educationbasic.6y:monthaug 0.967 0.333690
## educationbasic.9y:monthaug 1.939 0.052480 .
## educationhigh.school:monthaug -0.526 0.598559
## educationilliterate:monthaug 1.133 0.257055
## educationprofessional.course:monthaug -1.102 0.270358
## educationuniversity.degree:monthaug -3.592 0.000328 ***
## educationunknown:monthaug -0.970 0.332137
## educationbasic.6y:monthdec NA NA
## educationbasic.9y:monthdec -0.600 0.548243
## educationhigh.school:monthdec 0.008 0.994006
## educationilliterate:monthdec NA NA
## educationprofessional.course:monthdec 0.392 0.695176
## educationuniversity.degree:monthdec -0.718 0.472543
## educationunknown:monthdec -1.416 0.156695
## educationbasic.6y:monthjul -0.044 0.965152
## educationbasic.9y:monthjul 1.141 0.253893
## educationhigh.school:monthjul -1.403 0.160653
## educationilliterate:monthjul NA NA
## educationprofessional.course:monthjul -0.568 0.570195
## educationuniversity.degree:monthjul -3.225 0.001259 **
## educationunknown:monthjul -1.295 0.195397
## educationbasic.6y:monthjun 0.293 0.769180
## educationbasic.9y:monthjun 1.091 0.275429
## educationhigh.school:monthjun -1.482 0.138474
## educationilliterate:monthjun NA NA
## educationprofessional.course:monthjun -1.397 0.162451
## educationuniversity.degree:monthjun -2.947 0.003216 **
## educationunknown:monthjun -1.373 0.169623
## educationbasic.6y:monthmar 3.067 0.002161 **
## educationbasic.9y:monthmar 2.509 0.012125 *
## educationhigh.school:monthmar 3.475 0.000512 ***
## educationilliterate:monthmar NA NA
## educationprofessional.course:monthmar 2.421 0.015465 *
## educationuniversity.degree:monthmar 2.008 0.044603 *
## educationunknown:monthmar 2.062 0.039170 *
## educationbasic.6y:monthmay 0.163 0.870238
## educationbasic.9y:monthmay 0.886 0.375743
## educationhigh.school:monthmay -2.081 0.037449 *
## educationilliterate:monthmay NA NA
## educationprofessional.course:monthmay -1.711 0.087076 .
## educationuniversity.degree:monthmay -3.657 0.000256 ***
## educationunknown:monthmay -2.193 0.028350 *
## educationbasic.6y:monthnov 0.070 0.944167
## educationbasic.9y:monthnov 0.494 0.621055
## educationhigh.school:monthnov -1.121 0.262313
## educationilliterate:monthnov NA NA
## educationprofessional.course:monthnov -1.033 0.301547
## educationuniversity.degree:monthnov -2.740 0.006146 **
## educationunknown:monthnov -0.384 0.700945
## educationbasic.6y:monthoct 0.782 0.434480
## educationbasic.9y:monthoct 0.878 0.380123
## educationhigh.school:monthoct 3.725 0.000196 ***
## educationilliterate:monthoct NA NA
## educationprofessional.course:monthoct 0.062 0.950452
## educationuniversity.degree:monthoct -0.064 0.948758
## educationunknown:monthoct -3.076 0.002103 **
## educationbasic.6y:monthsep -1.061 0.288665
## educationbasic.9y:monthsep -1.438 0.150318
## educationhigh.school:monthsep -1.795 0.072674 .
## educationilliterate:monthsep NA NA
## educationprofessional.course:monthsep -2.273 0.023062 *
## educationuniversity.degree:monthsep -3.484 0.000495 ***
## educationunknown:monthsep -2.369 0.017820 *
## educationbasic.6y:day_of_weekmon 0.596 0.551160
## educationbasic.9y:day_of_weekmon -0.621 0.534898
## educationhigh.school:day_of_weekmon 0.021 0.983488
## educationilliterate:day_of_weekmon NA NA
## educationprofessional.course:day_of_weekmon -0.028 0.977538
## educationuniversity.degree:day_of_weekmon -0.570 0.568986
## educationunknown:day_of_weekmon 0.316 0.751795
## educationbasic.6y:day_of_weekthu 0.242 0.809011
## educationbasic.9y:day_of_weekthu 0.568 0.570020
## educationhigh.school:day_of_weekthu 0.048 0.961819
## educationilliterate:day_of_weekthu NA NA
## educationprofessional.course:day_of_weekthu 0.605 0.545298
## educationuniversity.degree:day_of_weekthu -0.074 0.940708
## educationunknown:day_of_weekthu 0.287 0.773944
## educationbasic.6y:day_of_weektue -0.071 0.943295
## educationbasic.9y:day_of_weektue -1.191 0.233491
## educationhigh.school:day_of_weektue -1.707 0.087815 .
## educationilliterate:day_of_weektue NA NA
## educationprofessional.course:day_of_weektue -0.214 0.830518
## educationuniversity.degree:day_of_weektue -1.414 0.157256
## educationunknown:day_of_weektue 0.608 0.543400
## educationbasic.6y:day_of_weekwed 0.374 0.708398
## educationbasic.9y:day_of_weekwed -1.043 0.296849
## educationhigh.school:day_of_weekwed 0.106 0.915469
## educationilliterate:day_of_weekwed NA NA
## educationprofessional.course:day_of_weekwed 0.025 0.979856
## educationuniversity.degree:day_of_weekwed -0.988 0.323223
## educationunknown:day_of_weekwed 0.740 0.459312
## defaultunknown:housingunknown -0.133 0.894523
## defaultyes:housingunknown NA NA
## defaultunknown:housingyes -1.124 0.261049
## defaultyes:housingyes -0.087 0.930554
## defaultunknown:loanunknown NA NA
## defaultyes:loanunknown NA NA
## defaultunknown:loanyes -0.625 0.531912
## defaultyes:loanyes NA NA
## defaultunknown:contacttelephone 3.486 0.000491 ***
## defaultyes:contacttelephone NA NA
## defaultunknown:monthaug 1.622 0.104818
## defaultyes:monthaug NA NA
## defaultunknown:monthdec 2.389 0.016904 *
## defaultyes:monthdec NA NA
## defaultunknown:monthjul 2.364 0.018102 *
## defaultyes:monthjul NA NA
## defaultunknown:monthjun 1.809 0.070502 .
## defaultyes:monthjun NA NA
## defaultunknown:monthmar 0.303 0.761915
## defaultyes:monthmar NA NA
## defaultunknown:monthmay 2.369 0.017866 *
## defaultyes:monthmay NA NA
## defaultunknown:monthnov 2.238 0.025199 *
## defaultyes:monthnov NA NA
## defaultunknown:monthoct 4.430 9.47e-06 ***
## defaultyes:monthoct NA NA
## defaultunknown:monthsep 1.492 0.135736
## defaultyes:monthsep NA NA
## defaultunknown:day_of_weekmon -0.550 0.582210
## defaultyes:day_of_weekmon NA NA
## defaultunknown:day_of_weekthu -1.069 0.284984
## defaultyes:day_of_weekthu NA NA
## defaultunknown:day_of_weektue -0.607 0.544137
## defaultyes:day_of_weektue NA NA
## defaultunknown:day_of_weekwed -1.211 0.226036
## defaultyes:day_of_weekwed NA NA
## housingunknown:loanunknown NA NA
## housingyes:loanunknown NA NA
## housingunknown:loanyes NA NA
## housingyes:loanyes -1.304 0.192213
## housingunknown:contacttelephone 1.190 0.234051
## housingyes:contacttelephone 0.756 0.449856
## housingunknown:monthaug -0.309 0.757410
## housingyes:monthaug -0.933 0.350710
## housingunknown:monthdec -0.373 0.708947
## housingyes:monthdec -1.552 0.120564
## housingunknown:monthjul -1.303 0.192510
## housingyes:monthjul -1.807 0.070699 .
## housingunknown:monthjun -2.347 0.018943 *
## housingyes:monthjun -2.414 0.015774 *
## housingunknown:monthmar -0.893 0.371609
## housingyes:monthmar -3.135 0.001720 **
## housingunknown:monthmay -1.505 0.132216
## housingyes:monthmay -1.426 0.153976
## housingunknown:monthnov -1.339 0.180580
## housingyes:monthnov -1.144 0.252608
## housingunknown:monthoct 0.596 0.551183
## housingyes:monthoct -1.817 0.069186 .
## housingunknown:monthsep -0.233 0.815635
## housingyes:monthsep -4.904 9.43e-07 ***
## housingunknown:day_of_weekmon 0.859 0.390252
## housingyes:day_of_weekmon 0.164 0.869851
## housingunknown:day_of_weekthu 0.963 0.335591
## housingyes:day_of_weekthu -0.498 0.618543
## housingunknown:day_of_weektue 1.251 0.211054
## housingyes:day_of_weektue -0.110 0.912397
## housingunknown:day_of_weekwed 0.454 0.649999
## housingyes:day_of_weekwed -0.041 0.967313
## loanunknown:contacttelephone NA NA
## loanyes:contacttelephone 0.579 0.562745
## loanunknown:monthaug NA NA
## loanyes:monthaug -0.933 0.350890
## loanunknown:monthdec NA NA
## loanyes:monthdec 0.347 0.728342
## loanunknown:monthjul NA NA
## loanyes:monthjul -0.901 0.367716
## loanunknown:monthjun NA NA
## loanyes:monthjun -0.803 0.421973
## loanunknown:monthmar NA NA
## loanyes:monthmar -2.993 0.002768 **
## loanunknown:monthmay NA NA
## loanyes:monthmay -0.748 0.454419
## loanunknown:monthnov NA NA
## loanyes:monthnov -0.409 0.682322
## loanunknown:monthoct NA NA
## loanyes:monthoct -1.134 0.256790
## loanunknown:monthsep NA NA
## loanyes:monthsep 1.793 0.072939 .
## loanunknown:day_of_weekmon NA NA
## loanyes:day_of_weekmon 0.487 0.626380
## loanunknown:day_of_weekthu NA NA
## loanyes:day_of_weekthu 0.880 0.378688
## loanunknown:day_of_weektue NA NA
## loanyes:day_of_weektue 0.497 0.618861
## loanunknown:day_of_weekwed NA NA
## loanyes:day_of_weekwed 0.451 0.652106
## contacttelephone:monthaug 0.637 0.524263
## contacttelephone:monthdec -1.901 0.057264 .
## contacttelephone:monthjul -0.947 0.343651
## contacttelephone:monthjun -11.792 < 2e-16 ***
## contacttelephone:monthmar -0.880 0.378729
## contacttelephone:monthmay -2.233 0.025570 *
## contacttelephone:monthnov 1.796 0.072457 .
## contacttelephone:monthoct -0.430 0.666964
## contacttelephone:monthsep -5.081 3.77e-07 ***
## contacttelephone:day_of_weekmon -0.711 0.476905
## contacttelephone:day_of_weekthu -0.442 0.658165
## contacttelephone:day_of_weektue 0.624 0.532574
## contacttelephone:day_of_weekwed -0.376 0.707077
## monthaug:day_of_weekmon -1.990 0.046583 *
## monthdec:day_of_weekmon 0.334 0.738108
## monthjul:day_of_weekmon -1.990 0.046561 *
## monthjun:day_of_weekmon -0.559 0.576453
## monthmar:day_of_weekmon -2.374 0.017594 *
## monthmay:day_of_weekmon -0.447 0.654863
## monthnov:day_of_weekmon -1.409 0.158759
## monthoct:day_of_weekmon -4.257 2.08e-05 ***
## monthsep:day_of_weekmon -1.096 0.272901
## monthaug:day_of_weekthu -8.549 < 2e-16 ***
## monthdec:day_of_weekthu -0.169 0.865652
## monthjul:day_of_weekthu -8.673 < 2e-16 ***
## monthjun:day_of_weekthu -6.640 3.19e-11 ***
## monthmar:day_of_weekthu -5.952 2.68e-09 ***
## monthmay:day_of_weekthu -8.182 2.89e-16 ***
## monthnov:day_of_weekthu -7.452 9.46e-14 ***
## monthoct:day_of_weekthu -4.852 1.23e-06 ***
## monthsep:day_of_weekthu -2.243 0.024887 *
## monthaug:day_of_weektue -5.971 2.38e-09 ***
## monthdec:day_of_weektue 1.383 0.166721
## monthjul:day_of_weektue -6.563 5.36e-11 ***
## monthjun:day_of_weektue -6.279 3.44e-10 ***
## monthmar:day_of_weektue -1.060 0.288955
## monthmay:day_of_weektue -6.743 1.58e-11 ***
## monthnov:day_of_weektue -5.170 2.36e-07 ***
## monthoct:day_of_weektue -3.444 0.000574 ***
## monthsep:day_of_weektue -0.887 0.375183
## monthaug:day_of_weekwed -5.108 3.27e-07 ***
## monthdec:day_of_weekwed 0.363 0.716453
## monthjul:day_of_weekwed -5.687 1.31e-08 ***
## monthjun:day_of_weekwed -3.998 6.39e-05 ***
## monthmar:day_of_weekwed -0.917 0.359126
## monthmay:day_of_weekwed -5.366 8.09e-08 ***
## monthnov:day_of_weekwed -4.759 1.96e-06 ***
## monthoct:day_of_weekwed -3.363 0.000772 ***
## monthsep:day_of_weekwed 0.029 0.976812
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2841 on 31888 degrees of freedom
## Multiple R-squared: 0.1701, Adjusted R-squared: 0.1526
## F-statistic: 9.709 on 673 and 31888 DF, p-value: < 2.2e-16
# accuracy of train data
pred_train_lm4 = predict(lm4,dta_train)
## Warning in predict.lm(lm4, dta_train): prediction from a rank-deficient fit
## may be misleading
pred_train_lm4 = as.data.frame(pred_train_lm4)
pred_train_lm4$y = ifelse(round(pred_train_lm4$pred_train_lm4,2)<0.5,'0','1')
confusionMatrix(as.factor(dta_train$y),as.factor(pred_train_lm4$y))
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 28767 324
## 1 2922 549
##
## Accuracy : 0.9003
## 95% CI : (0.897, 0.9035)
## No Information Rate : 0.9732
## P-Value [Acc > NIR] : 1
##
## Kappa : 0.2193
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.9078
## Specificity : 0.6289
## Pos Pred Value : 0.9889
## Neg Pred Value : 0.1582
## Prevalence : 0.9732
## Detection Rate : 0.8835
## Detection Prevalence : 0.8934
## Balanced Accuracy : 0.7683
##
## 'Positive' Class : 0
##
# accuracy of test data
pred_test_lm4 = predict(lm4,dta_test)
## Warning in predict.lm(lm4, dta_test): prediction from a rank-deficient fit
## may be misleading
pred_test_lm4 = as.data.frame(pred_test_lm4)
pred_test_lm4$y = ifelse(round(pred_test_lm4$pred_test_lm4,2)<0.5,'0','1')
confusionMatrix(as.factor(dta_test$y),as.factor(pred_test_lm4$y))
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 3594 63
## 1 363 51
##
## Accuracy : 0.8954
## 95% CI : (0.8855, 0.9046)
## No Information Rate : 0.972
## P-Value [Acc > NIR] : 1
##
## Kappa : 0.1561
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.9083
## Specificity : 0.4474
## Pos Pred Value : 0.9828
## Neg Pred Value : 0.1232
## Prevalence : 0.9720
## Detection Rate : 0.8828
## Detection Prevalence : 0.8983
## Balanced Accuracy : 0.6778
##
## 'Positive' Class : 0
##
lm4 is the one that overfits more. Its structural equation is the most complex one, and its accuracy of train data is 0.9003 which is the highest among the four models. However, its accuracy of test data decreases to 0.8954, indicating that the model doesn’t fit the unseen test data set which is the problem of overfitting. That’s why its accuracy of train data is really high (90%) but it performs the worst when we use the test data.
lm2 is the one that underfits more. Its structural equation is comparatively simple, and its accuracy of train data is 0.8924 which is the lowest among the four models. That means this model is too simple to fit the train data set well, which is the problem of underfitting.
lm4 is the model that fits the training data the best (90% accuracy) but it doesn’t have the best predictive power. Instead, its accuracy of test data is 0.8954 which is the lowest among the four models.
Yes, we can use a confusion matrix to analyze the problems a problem of underfitting because if a model encounters the problem of underfitting, its accuracy of train data will be comparatively low due to the too simple structural equation.
We should use training data to run these regressions so that machine can learn from the training data set and generate predictive models. Furthermore, we can use test data to test the performances among different models and choose which one has the best predictive power for new and unseen data set.
The last row and last column show the relationship between the Y and each of the X.
No, it doesn’t look linear because the dependent variable (Y) is binary variable (yes or no), thus the relationship between the Y and each of the X is not linear relationship.
pairs(dta_bank)
Furthermore, I examine the relationship between the predicted Y and each of the X, that is, the probability of y=1 (the household actually decides to join the bank) which can be continuous, the visualizations are shown as below. We can see that there is still no obvious linear relationship between predicted Y and each of the X.
y_predict=predict(lm(y~.,data=dta),dta)
## Warning in predict.lm(lm(y ~ ., data = dta), dta): prediction from a rank-
## deficient fit may be misleading
y_predict=as.data.frame(y_predict)
dta_viz=cbind(dta,y_predict)
dta_viz$y=NULL
dta_viz=as.data.frame(dta_viz)
pairs(dta_viz)
# Predicted y by Age
plot(dta_viz$age,dta_viz$y_predict,main="Predicted y by Age",xlab="Age",ylab="Predicted y")
# Predicted y by Job
plot(factor(dta_viz$job),dta_viz$y_predict,main="Predicted y by Job",xlab="Job",ylab="Predicted y")
# Predicted y by Marital
plot(factor(dta_viz$marital),dta_viz$y_predict,main="Predicted y by Marital",xlab="Marital",ylab="Predicted y")
# Predicted y by Education
plot(factor(dta_viz$education),dta_viz$y_predict,main="Predicted y by Education",xlab="Education",ylab="Predicted y")
# Predicted y by Default
plot(factor(dta_viz$default),dta_viz$y_predict,main="Predicted y by Default",xlab="Default",ylab="Predicted y")
# Predicted y by Housing
plot(factor(dta_viz$housing),dta_viz$y_predict,main="Predicted y by Housing",xlab="Housing",ylab="Predicted y")
# Predicted y by Loan
plot(factor(dta_viz$loan),dta_viz$y_predict,main="Predicted y by Loan",xlab="Loan",ylab="Predicted y")
# Predicted y by Contact
plot(factor(dta_viz$contact),dta_viz$y_predict,main="Predicted y by Contact",xlab="Contact",ylab="Predicted y")
# Predicted y by Month
plot(factor(dta_viz$month),dta_viz$y_predict,main="Predicted y by Month",xlab="Month",ylab="Predicted y")
# Predicted y by Day_of_week
plot(factor(dta_viz$day_of_week),dta_viz$y_predict,main="Predicted y by Day_of_week",xlab="Day_of_week",ylab="Predicted y")
For the naive bayes, the highest accuracy of valid data is 0.8885. Under this model, the accuracy of test data is 0.8904.
# Convert y to characters
dta_train$y = ifelse(dta_train$y==0,'no','yes')
dta_valid$y = ifelse(dta_valid$y==0,'no','yes')
dta_test$y = ifelse(dta_test$y==0,'no','yes')
val_y = as.data.frame(val_y)
val_y = ifelse(val_y$val_y==0,'no','yes')
test_y = as.data.frame(test_y)
test_y = ifelse(test_y$test_y==0,'no','yes')
# Training and tuning a model on the train data
# This is the one with the best performance
NBclassifier=naivebayes::naive_bayes(formula = y~.,
laplace = 1,
data = dta_train)
# Using a confusion matrix on valid data
pred_valid=predict(NBclassifier,newdata = val_x)
prediction=as.factor(pred_valid)
test=as.factor(val_y)
confusionMatrix(prediction,test)
## Confusion Matrix and Statistics
##
## Reference
## Prediction no yes
## no 3506 350
## yes 104 110
##
## Accuracy : 0.8885
## 95% CI : (0.8784, 0.898)
## No Information Rate : 0.887
## P-Value [Acc > NIR] : 0.395
##
## Kappa : 0.2743
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.9712
## Specificity : 0.2391
## Pos Pred Value : 0.9092
## Neg Pred Value : 0.5140
## Prevalence : 0.8870
## Detection Rate : 0.8614
## Detection Prevalence : 0.9474
## Balanced Accuracy : 0.6052
##
## 'Positive' Class : no
##
# evaluate the naive bayes model using test data
pred_test=predict(NBclassifier,newdata = test_x)
prediction=as.factor(pred_test)
test=as.factor(test_y)
confusionMatrix(prediction,test)
## Confusion Matrix and Statistics
##
## Reference
## Prediction no yes
## no 3539 328
## yes 118 86
##
## Accuracy : 0.8904
## 95% CI : (0.8804, 0.8999)
## No Information Rate : 0.8983
## P-Value [Acc > NIR] : 0.9528
##
## Kappa : 0.2264
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.9677
## Specificity : 0.2077
## Pos Pred Value : 0.9152
## Neg Pred Value : 0.4216
## Prevalence : 0.8983
## Detection Rate : 0.8693
## Detection Prevalence : 0.9499
## Balanced Accuracy : 0.5877
##
## 'Positive' Class : no
##
For the KNN, the highest accuracy of valid data is 0.884. Under this model, the accuracy of test data is 0.8949.
dta_bank_knn=model.matrix(~.-1,dta_bank)
dta_bank_knn=as.data.frame(dta_bank_knn)
# Normalizing function and normalizing the data
dta_bank_knn$age = (dta_bank_knn$age - min(dta_bank_knn$age)) / (max(dta_bank_knn$age) - min(dta_bank_knn$age))
# Generate index for spliting original dataset
set.seed(123456)
len = nrow(dta_bank_knn)
train_index = sample(1:len, round(len*0.8, 0))
val_index = sample((1:len)[-train_index], round(len*0.1, 0))
test_index = (1:len)[-c(train_index, val_index)]
cat(sprintf('[Description]\n Number of sample: %7s\n Training set: %11s\n Validation set: %8s\n Test set: %14s',
len, length(train_index), length(val_index), length(test_index)))
## [Description]
## Number of sample: 40703
## Training set: 32562
## Validation set: 4070
## Test set: 4071
# Generate training set, validation set and testing set
X = colnames(dta_bank_knn)[colnames(dta_bank_knn) != 'y']
train_x = dta_bank_knn[train_index, X]
train_y = (dta_bank_knn[train_index, ])$y
val_x = dta_bank_knn[val_index, X]
val_y = (dta_bank_knn[val_index, ])$y
test_x = dta_bank_knn[test_index, X]
test_y = (dta_bank_knn[test_index, ])$y
dataset_list = list(train_x=train_x, train_y=train_y, val_x=val_x,
val_y=val_y, test_x=test_x, test_y=test_y,
train_n=length(train_index), val_n=length(val_index), test_n=length(test_index))
dta_train = dta_bank_knn[ train_index, ]
dta_valid = dta_bank_knn[ val_index, ]
dta_test = dta_bank_knn[ test_index, ]
# Training and tuning model on dta_training
# Maximum accuracy at k=10
bank_valid_pred = class::knn(train = train_x,
cl = train_y,
test = val_x,
k = 10)
# Evaluating performance on dta_test
prediction=as.factor(bank_valid_pred)
test=as.factor(val_y)
confusionMatrix(prediction,test)
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 3565 427
## 1 45 33
##
## Accuracy : 0.884
## 95% CI : (0.8738, 0.8937)
## No Information Rate : 0.887
## P-Value [Acc > NIR] : 0.7333
##
## Kappa : 0.093
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.98753
## Specificity : 0.07174
## Pos Pred Value : 0.89304
## Neg Pred Value : 0.42308
## Prevalence : 0.88698
## Detection Rate : 0.87592
## Detection Prevalence : 0.98084
## Balanced Accuracy : 0.52964
##
## 'Positive' Class : 0
##
#find the optimized k
i=1 # declaration to initiate for loop
k.optm=1 # declaration to initiate for loop
for (i in 1:18){
knn.mod=knn(train=train_x, test=val_x, cl=train_y, k=i)
k.optm[i]=100 * sum(val_y == knn.mod)/NROW(val_y)
k=i
cat(k,'=',k.optm[i],'\n') # to print % accuracy
}
## 1 = 84.22604
## 2 = 84.71744
## 3 = 87.32187
## 4 = 87.37101
## 5 = 87.73956
## 6 = 88.05897
## 7 = 88.05897
## 8 = 88.40295
## 9 = 88.50123
## 10 = 88.5258
## 11 = 88.40295
## 12 = 88.47666
## 13 = 88.35381
## 14 = 88.42752
## 15 = 88.42752
## 16 = 88.23096
## 17 = 88.2801
## 18 = 88.2801
# evaluate the KNN model with k=9 using test data
bank_test_pred = class::knn(train = train_x,
cl = train_y,
test = test_x,
k = 10)
# Evaluate the predictive performance of KNN using confusion matrices
prediction=as.factor(bank_test_pred)
test=as.factor(test_y)
confusionMatrix(prediction,test)
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 3617 388
## 1 40 26
##
## Accuracy : 0.8949
## 95% CI : (0.885, 0.9041)
## No Information Rate : 0.8983
## P-Value [Acc > NIR] : 0.7748
##
## Kappa : 0.0827
##
## Mcnemar's Test P-Value : <2e-16
##
## Sensitivity : 0.9891
## Specificity : 0.0628
## Pos Pred Value : 0.9031
## Neg Pred Value : 0.3939
## Prevalence : 0.8983
## Detection Rate : 0.8885
## Detection Prevalence : 0.9838
## Balanced Accuracy : 0.5259
##
## 'Positive' Class : 0
##
It seems that the naive bayes and KNN predictive method don’t make it better, because the accuracy of test data of naive bayes and KNN are not higher than that of linear regression models.
When the business concern is to know one unit change of the independent variables (X) can increase or decrease how much the probability of y=1 (the household actually decides to join the bank), that is, the unbiased parameters multiplying the X variables, we will prefer a causal analysis to a predictive analysis.
For example, we have known that Wednesday in March is the best time to perform telemarketing tasks because the coefficients on these are positive and comparatively biggest. But if we what to know that how much exactly the probability of y=1 increased by this “best time” holding other variables consistent, in other words the vairables “is_wed” and “is_mar” are 1, we need to conduct a causal analysis and see their coefficients.
The biggest difference between a causal analysis and a predictive analysis is whether the parameters multiplying the X variables should be unbiased. For the causal analysis, we should make sure that the parameters is unbiased because the estimated coefficients have a causal interpretation. However, for the predictive analysis, we don’t need the unbiased estimated coefficients but we care about the predictive capacity of the model (e.g. MSPE), so we even increase the bias to decrease the variance so that the predictive capacity becomes better (e.g. lower MSPE). Thus, the estimated coefficients are usually biased and don’t have a causal interpretation in the predictive analysis.
An biased estimator is one which delivers an estimate which is consistently different from the parameter to be estimated. In statistics, the bias of an estimator is the difference between this estimator’s expected value and the true value of the parameter being estimated. In a more formal definition we can define that the expectation of a biased estimator is not equal to the parameter of a population.
The biased estimate can be caused by many problems, omitted variables bias is one of the most common ones. When there are some omitted variables that are correlated with the independent variables and can influence the dependent variable, the potential omitted variables problem will come into being. If a model encounters the omitted variables problem, the estimated coefficients will have upward or downward bias, resulting in invalid causal interpretation for causal analysis.
However, for the predictive analysis, we sometimes intentionally increase the bias to decrease the variance so that the predictive capacity becomes better (e.g. lower MSPE), because we don’t need unbiased estimated coefficients in a predictive model. The detailed information is discussed above in the last question.
Job, marital status, education, month, and day of week can be interesting to analyze from a causal point of view.
Job: Job can be a refelction of different income groups. By converting the variable “job” into 1 to 12 that 1 represents the job with lowest average income and 12 represents the job with highest average income, we can figure out that a change in job or income group can bring how much change in the the probability of y=1 (the household actually decides to join the bank). This can help us know the relationship between the job (income group) and the probability to join, so that we can target the exact customer group.
Marital status: Marital status shows the stability of a household which is also related with the demand of joining a bank. We can figure out that which mariatal status can increase probability to join most and by how much. This can help us know the relationship between the marital status and the probability to join, so that we can target the exact customer group.
Education: The assumption behind the education is that the higher education that a household has, the more demand of joining a bank. Because the household with higher education usually has more income and have a need for a bank account. We can figure out that which education group can increase probability to join most and by how much. This can help us know the relationship between the education status and the probability to join, so that we can target the exact customer group.
Month and day of week: month and day of week can tell us best time to perform telemarketing tasks which guide the time schedule of bank telemarketing. We can figure out that which time can increase probability to join most and by how much. This can help us know the relationship between the month and day of week and the probability to join, so that we conduct telemarketing at proper time.
str(dta_bank)
## 'data.frame': 40703 obs. of 11 variables:
## $ age : int 56 57 37 40 56 45 59 41 24 25 ...
## $ job : Factor w/ 12 levels "admin.","blue-collar",..: 4 8 8 1 8 8 1 2 10 8 ...
## $ marital : Factor w/ 4 levels "divorced","married",..: 2 2 2 2 2 2 2 2 3 3 ...
## $ education : Factor w/ 8 levels "basic.4y","basic.6y",..: 1 4 4 2 4 3 6 8 6 4 ...
## $ default : Factor w/ 3 levels "no","unknown",..: 1 2 1 1 1 2 1 2 1 1 ...
## $ housing : Factor w/ 3 levels "no","unknown",..: 1 1 3 1 1 1 1 1 3 3 ...
## $ loan : Factor w/ 3 levels "no","unknown",..: 1 1 1 1 3 1 1 1 1 1 ...
## $ contact : Factor w/ 2 levels "cellular","telephone": 2 2 2 2 2 2 2 2 2 2 ...
## $ month : Factor w/ 10 levels "apr","aug","dec",..: 7 7 7 7 7 7 7 7 7 7 ...
## $ day_of_week: Factor w/ 5 levels "fri","mon","thu",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ y : num 0 0 0 0 0 0 0 0 0 0 ...
Time of the day and race may be the potential omitted variables that can cause the omitted variables problem.
Time of the day: The time of the day (morning, afternoon, after-work, etc.) can be a ommitted variable. A retired person may have more free time during the day to answer the phone patiently and make a decision to join the bank. While a manager is too busy to answer the phone patiently and thus refuse to join the bank. This causes the bias of the coefficient on job.
Race: Race is related to education and marriage, and can also affect decisions to join a bank. For example, some ethnic groups are more likely to be highly educated, have stable marriages and are used to saving because of their beliefs or culture (e.g. Asian), causing the upward bias on marital status and education.
In conclusion, we should include the omitted variables in the model to generate more accurate estimated coefficients on the variables we are interested.