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_1_)
The following objects are masked from Group_1_ (pos = 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

The following objects are masked from Group_1_ (pos = 4):

    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 
-135555   -8792   -1519    6764  100447 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 1.579e+04  2.373e+02   66.55   <2e-16 ***
INCOME      6.734e-02  1.227e-03   54.86   <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.2033,    Adjusted R-squared:  0.2032 
F-statistic:  3010 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 
-25574 -10505  -2143   7465 109520 

Coefficients:
                Estimate Std. Error t value Pr(>|t|)    
factor(GENDER)F  26416.3      163.1   162.0   <2e-16 ***
factor(GENDER)M  28359.6      224.9   126.1   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 14340 on 11798 degrees of freedom
Multiple R-squared:  0.7813,    Adjusted R-squared:  0.7812 
F-statistic: 2.107e+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 
-24664 -10687  -2133   7650 108675 

Coefficients:
                                        Estimate Std. Error t value Pr(>|t|)    
factor(HOUSING_TYPE)Co-op Apartment      23808.4     1972.4   12.07   <2e-16 ***
factor(HOUSING_TYPE)Municipal Apartment  27237.7      675.4   40.33   <2e-16 ***
factor(HOUSING_TYPE)Office Apartment     26121.7     1443.2   18.10   <2e-16 ***
factor(HOUSING_TYPE)Own Apartment        27261.2      140.7  193.75   <2e-16 ***
factor(HOUSING_TYPE)Rented Apartment     25580.5     1007.8   25.38   <2e-16 ***
factor(HOUSING_TYPE)With Parents         24800.1      597.3   41.52   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 14360 on 11794 degrees of freedom
Multiple R-squared:  0.7808,    Adjusted R-squared:  0.7807 
F-statistic:  7001 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 
-27536 -10359  -2012   7431 109990 

Coefficients:
                                   Estimate Std. Error t value Pr(>|t|)    
factor(EDUCATION)Academic degree    28529.8     4743.6   6.014 1.86e-09 ***
factor(EDUCATION)Higher education   30511.4      265.2 115.062  < 2e-16 ***
factor(EDUCATION)Incomplete higher  27962.0      735.9  37.999  < 2e-16 ***
factor(EDUCATION)Lower secondary    22953.1     1125.0  20.402  < 2e-16 ***
factor(EDUCATION)Secondary          25946.3      155.5 166.875  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 14230 on 11795 degrees of freedom
Multiple R-squared:  0.7847,    Adjusted R-squared:  0.7846 
F-statistic:  8597 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)
plot(model_5)
not plotting observations with leverage one:
  10278

not plotting observations with leverage one:
  10278

#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 
-131266   -8755   -1474    6853  100872 

Coefficients:
                                        Estimate Std. Error t value Pr(>|t|)    
factor(EMPLOYMENT)Commercial Associate 1.719e+04  3.519e+02  48.851   <2e-16 ***
factor(EMPLOYMENT)Pensioner            1.488e+04  3.291e+02  45.199   <2e-16 ***
factor(EMPLOYMENT)State Servant        1.712e+04  5.084e+02  33.680   <2e-16 ***
factor(EMPLOYMENT)Student              1.050e+04  1.281e+04   0.820    0.412    
factor(EMPLOYMENT)Unemployed           5.878e+03  9.060e+03   0.649    0.516    
factor(EMPLOYMENT)Working              1.588e+04  2.607e+02  60.894   <2e-16 ***
INCOME                                 6.560e-02  1.256e-03  52.230   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 12810 on 11793 degrees of freedom
Multiple R-squared:  0.8257,    Adjusted R-squared:  0.8256 
F-statistic:  7980 on 7 and 11793 DF,  p-value: < 2.2e-16
plot(model_6)
not plotting observations with leverage one:
  10278

not plotting observations with leverage one:
  10278

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.

LS0tCnRpdGxlOiAiUiBOb3RlYm9vayIKb3V0cHV0OgogIGh0bWxfbm90ZWJvb2s6IGRlZmF1bHQKICB3b3JkX2RvY3VtZW50OiBkZWZhdWx0CiAgcGRmX2RvY3VtZW50OiBkZWZhdWx0CiAgaHRtbF9kb2N1bWVudDoKICAgIGRmX3ByaW50OiBwYWdlZAotLS0KClRoaXMgaXMgYW4gW1IgTWFya2Rvd25dKGh0dHA6Ly9ybWFya2Rvd24ucnN0dWRpby5jb20pIE5vdGVib29rLiBXaGVuIHlvdSBleGVjdXRlIGNvZGUgd2l0aGluIHRoZSBub3RlYm9vaywgdGhlIHJlc3VsdHMgYXBwZWFyIGJlbmVhdGggdGhlIGNvZGUuIAoKVHJ5IGV4ZWN1dGluZyB0aGlzIGNodW5rIGJ5IGNsaWNraW5nIHRoZSAqUnVuKiBidXR0b24gd2l0aGluIHRoZSBjaHVuayBvciBieSBwbGFjaW5nIHlvdXIgY3Vyc29yIGluc2lkZSBpdCBhbmQgcHJlc3NpbmcgKkNtZCtTaGlmdCtFbnRlciouIAoKYGBge3J9CmF0dGFjaChHcm91cF8xXykKIyBSZWdyZXNzaW9uIERlcGVuZGVuY2Ugb24gdGhlIGJhc2lzIG9mIEluY29tZQptb2RlbF8xPC1sbShBTk5VSVRZfklOQ09NRSkKc3VtbWFyeShtb2RlbF8xKQpwbG90KG1vZGVsXzEpCgojIFJlZ3Jlc3Npb24gZGVwZW5kZW5jZSBvbiB0aGUgYmFzaXMgb2YgZ2VuZGVyLgptb2RlbF8yPC1sbShBTk5VSVRZfmZhY3RvcihHRU5ERVIpLTEpCnN1bW1hcnkobW9kZWxfMikKcGxvdChtb2RlbF8yKQoKIyBSZWdyZXNzaW9uIGRlcGVuZGVuY2Ugb24gdGhlIGJhc2lzIG9mIG93bmVyc2h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