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.