This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Cmd+Shift+Enter.

attach(Group_4_)
The following objects are masked from Group_3_:

    ANNUITY, CHILDREN, CREDIT, DAYS_BIRTH, DAYS_EMPLOYED, DAYS_LAST_PHONE_CHANGE,
    DAYS_REGISTRATION, DEF_LARGE_SOCIAL_CIRCLE, DEF_SMALL_SOCIAL_CIRCLE, DOC_01,
    DOC_02, DOC_03, DOC_04, DOC_05, DOC_06, DOC_07, DOC_08, DOC_09, DOC_10, DOC_11,
    DOC_12, DOC_13, DOC_14, DOC_15, DOC_16, DOC_17, DOC_18, DOC_19, DOC_20,
    EDUCATION, EMAIL, EMPLOYMENT, EMP_PHONE, FAMILY, FAMILY_STATUS, GENDER,
    GOODS_PRICE, HOME_PHONE, HOUSING_TYPE, INCOME, LIVE_CITY_NOT_WORK_CITY,
    LIVE_REGION_NOT_WORK_REGION, NAME_TYPE_SUITE, OBS_LARGE_SOCIAL_CIRCLE,
    OBS_SMALL_SOCIAL_CIRCLE, OCCUPATION, ORGANIZATION_TYPE, OTHER_MOBILE, OWN_CAR,
    OWN_MOBILE, OWN_REALTY, PROCESS_START_DAY, PROCESS_START_HOUR, REGION_RATING,
    REGION_RATING_CITY, REG_CITY_NOT_LIVE_CITY, REG_CITY_NOT_WORK_CITY,
    REG_REGION_NOT_LIVE_REGION, REG_REGION_NOT_WORK_REGION, WORK_PHONE
# Regression Dependence on the basis of Income
model_1<-lm(ANNUITY~INCOME)
summary(model_1)

Call:
lm(formula = ANNUITY ~ INCOME)

Residuals:
    Min      1Q  Median      3Q     Max 
-179511   -8698   -1620    6650  111478 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 1.621e+04  2.321e+02   69.85   <2e-16 ***
INCOME      6.447e-02  1.191e-03   54.15   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 12830 on 11798 degrees of freedom
Multiple R-squared:  0.1991,    Adjusted R-squared:  0.199 
F-statistic:  2932 on 1 and 11798 DF,  p-value: < 2.2e-16
plot(model_1)

# Regression dependence on the basis of gender.
model_2<-lm(ANNUITY~factor(GENDER)-1)
summary(model_2)

Call:
lm(formula = ANNUITY ~ factor(GENDER) - 1)

Residuals:
   Min     1Q Median     3Q    Max 
-28774 -10379  -2278   7115 116711 

Coefficients:
                Estimate Std. Error t value Pr(>|t|)    
factor(GENDER)F  26128.7      162.0   161.3   <2e-16 ***
factor(GENDER)M  28773.9      225.2   127.8   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 14280 on 11798 degrees of freedom
Multiple R-squared:  0.7821,    Adjusted R-squared:  0.7821 
F-statistic: 2.118e+04 on 2 and 11798 DF,  p-value: < 2.2e-16
plot(model_2)

# Regression dependence on the basis of ownership of home.
model_3<-lm(ANNUITY~factor(HOUSING_TYPE)-1)
summary(model_3)

Call:
lm(formula = ANNUITY ~ factor(HOUSING_TYPE) - 1)

Residuals:
   Min     1Q Median     3Q    Max 
-27139 -10574  -2252   7327 118346 

Coefficients:
                                        Estimate Std. Error t value Pr(>|t|)    
factor(HOUSING_TYPE)Co-op Apartment      24738.1     2294.9   10.78   <2e-16 ***
factor(HOUSING_TYPE)Municipal Apartment  27458.8      715.7   38.37   <2e-16 ***
factor(HOUSING_TYPE)Office Apartment     27772.2     1563.7   17.76   <2e-16 ***
factor(HOUSING_TYPE)Own Apartment        27138.5      139.9  193.95   <2e-16 ***
factor(HOUSING_TYPE)Rented Apartment     26334.5     1031.6   25.53   <2e-16 ***
factor(HOUSING_TYPE)With Parents         25099.2      589.0   42.61   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 14330 on 11794 degrees of freedom
Multiple R-squared:  0.7807,    Adjusted R-squared:  0.7806 
F-statistic:  6998 on 6 and 11794 DF,  p-value: < 2.2e-16
plot(model_3)

#Regression dependence on the basis of Education
model_4<-lm(ANNUITY~factor(EDUCATION)-1)
summary(model_4)

Call:
lm(formula = ANNUITY ~ factor(EDUCATION) - 1)

Residuals:
   Min     1Q Median     3Q    Max 
-30759 -10200  -2031   7197 114726 

Coefficients:
                                   Estimate Std. Error t value Pr(>|t|)    
factor(EDUCATION)Academic degree    35742.0     6338.2   5.639 1.75e-08 ***
factor(EDUCATION)Higher education   30758.7      263.8 116.612  < 2e-16 ***
factor(EDUCATION)Incomplete higher  27103.4      758.6  35.726  < 2e-16 ***
factor(EDUCATION)Lower secondary    22410.3     1120.4  20.001  < 2e-16 ***
factor(EDUCATION)Secondary          25828.8      154.6 167.020  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 14170 on 11795 degrees of freedom
Multiple R-squared:  0.7855,    Adjusted R-squared:  0.7854 
F-statistic:  8640 on 5 and 11795 DF,  p-value: < 2.2e-16
plot(model_4)

#Regression dependence on the basis of Employment
model_5<-lm(ANNUITY~factor(EMPLOYMENT)-1)
summary(model_5)

Call:
lm(formula = ANNUITY ~ factor(EMPLOYMENT) - 1)

Residuals:
   Min     1Q Median     3Q    Max 
-29749 -10201  -2129   7115 115736 

Coefficients:
                                       Estimate Std. Error t value Pr(>|t|)    
factor(EMPLOYMENT)Commercial Associate  29748.6      270.4 110.018  < 2e-16 ***
factor(EMPLOYMENT)Pensioner             23920.2      313.0  76.431  < 2e-16 ***
factor(EMPLOYMENT)State Servant         28755.8      476.3  60.379  < 2e-16 ***
factor(EMPLOYMENT)Student               23274.3     8203.1   2.837  0.00456 ** 
factor(EMPLOYMENT)Working               26600.2      182.1 146.042  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 14210 on 11795 degrees of freedom
Multiple R-squared:  0.7845,    Adjusted R-squared:  0.7844 
F-statistic:  8585 on 5 and 11795 DF,  p-value: < 2.2e-16
plot(model_5)

#Regression on employment and gender
model_6<-lm(ANNUITY~factor(EMPLOYMENT)-1+INCOME)
summary(model_6)

Call:
lm(formula = ANNUITY ~ factor(EMPLOYMENT) - 1 + INCOME)

Residuals:
    Min      1Q  Median      3Q     Max 
-175876   -8672   -1634    6631  111580 

Coefficients:
                                        Estimate Std. Error t value Pr(>|t|)    
factor(EMPLOYMENT)Commercial Associate 1.712e+04  3.442e+02  49.754   <2e-16 ***
factor(EMPLOYMENT)Pensioner            1.528e+04  3.275e+02  46.663   <2e-16 ***
factor(EMPLOYMENT)State Servant        1.769e+04  4.794e+02  36.892   <2e-16 ***
factor(EMPLOYMENT)Student              1.313e+04  7.402e+03   1.774   0.0761 .  
factor(EMPLOYMENT)Working              1.631e+04  2.572e+02  63.402   <2e-16 ***
INCOME                                 6.321e-02  1.216e-03  51.993   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 12820 on 11794 degrees of freedom
Multiple R-squared:  0.8246,    Adjusted R-squared:  0.8246 
F-statistic:  9244 on 6 and 11794 DF,  p-value: < 2.2e-16
plot(model_6)

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Cmd+Option+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Cmd+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.

LS0tCnRpdGxlOiAiUiBOb3RlYm9vayIKb3V0cHV0OgogIGh0bWxfbm90ZWJvb2s6IGRlZmF1bHQKICB3b3JkX2RvY3VtZW50OiBkZWZhdWx0CiAgcGRmX2RvY3VtZW50OiBkZWZhdWx0Ci0tLQoKVGhpcyBpcyBhbiBbUiBNYXJrZG93bl0oaHR0cDovL3JtYXJrZG93bi5yc3R1ZGlvLmNvbSkgTm90Z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