heart <- read.csv("~/Downloads/heart.csv")
Chi Squared Tests
chisq.test(heart$sex, heart$target)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: heart$sex and heart$target
## X-squared = 22.717, df = 1, p-value = 1.877e-06
chisq.test(heart$age, heart$target)
## Warning in chisq.test(heart$age, heart$target): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: heart$age and heart$target
## X-squared = 50.129, df = 40, p-value = 0.1309
chisq.test(heart$cp, heart$target)
##
## Pearson's Chi-squared test
##
## data: heart$cp and heart$target
## X-squared = 81.686, df = 3, p-value < 2.2e-16
chisq.test(heart$trestbps, heart$target)
## Warning in chisq.test(heart$trestbps, heart$target): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: heart$trestbps and heart$target
## X-squared = 47.706, df = 48, p-value = 0.4848
chisq.test(heart$chol, heart$target)
## Warning in chisq.test(heart$chol, heart$target): Chi-squared approximation may
## be incorrect
##
## Pearson's Chi-squared test
##
## data: heart$chol and heart$target
## X-squared = 173.1, df = 151, p-value = 0.1052
chisq.test(heart$fbs, heart$target)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: heart$fbs and heart$target
## X-squared = 0.10627, df = 1, p-value = 0.7444
chisq.test(heart$restecg, heart$target)
## Warning in chisq.test(heart$restecg, heart$target): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: heart$restecg and heart$target
## X-squared = 10.023, df = 2, p-value = 0.006661
chisq.test(heart$thalach, heart$target)
## Warning in chisq.test(heart$thalach, heart$target): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: heart$thalach and heart$target
## X-squared = 110.13, df = 90, p-value = 0.07348
chisq.test(heart$exang, heart$target)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: heart$exang and heart$target
## X-squared = 55.945, df = 1, p-value = 7.454e-14
chisq.test(heart$oldpeak, heart$target)
## Warning in chisq.test(heart$oldpeak, heart$target): Chi-squared approximation
## may be incorrect
##
## Pearson's Chi-squared test
##
## data: heart$oldpeak and heart$target
## X-squared = 89.433, df = 39, p-value = 7.803e-06
chisq.test(heart$slope, heart$target)
##
## Pearson's Chi-squared test
##
## data: heart$slope and heart$target
## X-squared = 47.507, df = 2, p-value = 4.831e-11
chisq.test(heart$ca, heart$target)
## Warning in chisq.test(heart$ca, heart$target): Chi-squared approximation may be
## incorrect
##
## Pearson's Chi-squared test
##
## data: heart$ca and heart$target
## X-squared = 74.367, df = 4, p-value = 2.712e-15
chisq.test(heart$thal, heart$target)
## Warning in chisq.test(heart$thal, heart$target): Chi-squared approximation may
## be incorrect
##
## Pearson's Chi-squared test
##
## data: heart$thal and heart$target
## X-squared = 85.304, df = 3, p-value < 2.2e-16
Logistic Regression
fit1 <- glm(target ~ age + sex + cp + trestbps + chol + fbs + restecg + thalach + exang + oldpeak + slope + ca + thal, data=heart)
summary(fit1)
##
## Call:
## glm(formula = target ~ age + sex + cp + trestbps + chol + fbs +
## restecg + thalach + exang + oldpeak + slope + ca + thal,
## data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.94748 -0.21270 0.06608 0.25022 0.93509
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.8288987 0.2929344 2.830 0.004987 **
## age -0.0008204 0.0026962 -0.304 0.761129
## sex -0.1959956 0.0471429 -4.157 4.24e-05 ***
## cp 0.1127034 0.0223816 5.036 8.40e-07 ***
## trestbps -0.0019910 0.0012573 -1.583 0.114407
## chol -0.0003535 0.0004217 -0.838 0.402545
## fbs 0.0173736 0.0596669 0.291 0.771125
## restecg 0.0498480 0.0399228 1.249 0.212819
## thalach 0.0030193 0.0011304 2.671 0.007988 **
## exang -0.1440459 0.0513689 -2.804 0.005387 **
## oldpeak -0.0587887 0.0229269 -2.564 0.010847 *
## slope 0.0789788 0.0423896 1.863 0.063453 .
## ca -0.1006022 0.0218565 -4.603 6.25e-06 ***
## thal -0.1190392 0.0356550 -3.339 0.000952 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1254512)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 36.255 on 289 degrees of freedom
## AIC: 246.56
##
## Number of Fisher Scoring iterations: 2
fit2 <- glm(target ~ sex + cp + trestbps + chol + fbs + restecg + thalach + exang + oldpeak + slope + ca + thal, data=heart)
summary(fit2)
##
## Call:
## glm(formula = target ~ sex + cp + trestbps + chol + fbs + restecg +
## thalach + exang + oldpeak + slope + ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.94510 -0.20824 0.06552 0.25352 0.93099
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.7826800 0.2500859 3.130 0.001929 **
## sex -0.1945151 0.0468177 -4.155 4.29e-05 ***
## cp 0.1123606 0.0223183 5.034 8.43e-07 ***
## trestbps -0.0020769 0.0012233 -1.698 0.090609 .
## chol -0.0003754 0.0004149 -0.905 0.366416
## fbs 0.0162093 0.0594508 0.273 0.785315
## restecg 0.0505379 0.0397960 1.270 0.205130
## thalach 0.0031464 0.0010488 3.000 0.002934 **
## exang -0.1428540 0.0511391 -2.793 0.005562 **
## oldpeak -0.0590104 0.0228794 -2.579 0.010396 *
## slope 0.0787046 0.0423136 1.860 0.063894 .
## ca -0.1018455 0.0214375 -4.751 3.19e-06 ***
## thal -0.1192317 0.0355936 -3.350 0.000916 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1250587)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 36.267 on 290 degrees of freedom
## AIC: 244.66
##
## Number of Fisher Scoring iterations: 2
fit3 <- glm(target ~ age + cp + trestbps + chol + fbs + restecg + thalach + exang + oldpeak + slope + ca + thal, data=heart)
summary(fit3)
##
## Call:
## glm(formula = target ~ age + cp + trestbps + chol + fbs + restecg +
## thalach + exang + oldpeak + slope + ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.02377 -0.22082 0.06495 0.24242 0.87612
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.876e-01 2.951e-01 1.991 0.04737 *
## age 3.364e-04 2.756e-03 0.122 0.90293
## cp 1.100e-01 2.299e-02 4.784 2.74e-06 ***
## trestbps -1.691e-03 1.290e-03 -1.311 0.19099
## chol 2.799e-05 4.230e-04 0.066 0.94729
## fbs 3.715e-03 6.123e-02 0.061 0.95166
## restecg 6.550e-02 4.085e-02 1.604 0.10986
## thalach 3.066e-03 1.162e-03 2.639 0.00875 **
## exang -1.656e-01 5.252e-02 -3.153 0.00178 **
## oldpeak -6.443e-02 2.352e-02 -2.739 0.00654 **
## slope 7.101e-02 4.352e-02 1.632 0.10383
## ca -1.100e-01 2.234e-02 -4.926 1.42e-06 ***
## thal -1.487e-01 3.590e-02 -4.142 4.52e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1324958)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 38.424 on 290 degrees of freedom
## AIC: 262.16
##
## Number of Fisher Scoring iterations: 2
fit4 <- glm(target ~ age + sex + trestbps + chol + fbs + restecg + thalach + exang + oldpeak + slope + ca + thal, data=heart)
summary(fit4)
##
## Call:
## glm(formula = target ~ age + sex + trestbps + chol + fbs + restecg +
## thalach + exang + oldpeak + slope + ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.97925 -0.23875 0.06748 0.23132 0.92925
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.7932243 0.3048987 2.602 0.009755 **
## age -0.0001370 0.0028036 -0.049 0.961065
## sex -0.1890932 0.0490619 -3.854 0.000143 ***
## trestbps -0.0015416 0.0013058 -1.181 0.238718
## chol -0.0004671 0.0004384 -1.065 0.287582
## fbs 0.0507032 0.0617386 0.821 0.412175
## restecg 0.0548666 0.0415526 1.320 0.187738
## thalach 0.0039191 0.0011621 3.373 0.000846 ***
## exang -0.2226387 0.0509542 -4.369 1.74e-05 ***
## oldpeak -0.0574860 0.0238687 -2.408 0.016646 *
## slope 0.0753585 0.0441275 1.708 0.088753 .
## ca -0.1158830 0.0225354 -5.142 5.00e-07 ***
## thal -0.1320475 0.0370246 -3.566 0.000423 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1359876)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 39.436 on 290 degrees of freedom
## AIC: 270.05
##
## Number of Fisher Scoring iterations: 2
fit5 <- glm(target ~ sex + restecg + thalach + exang + oldpeak + ca + thal, data=heart)
summary(fit5)
##
## Call:
## glm(formula = target ~ sex + restecg + thalach + exang + oldpeak +
## ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.99192 -0.22872 0.06124 0.23589 0.87787
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.545415 0.187655 2.906 0.003932 **
## sex -0.166271 0.047128 -3.528 0.000485 ***
## restecg 0.070221 0.040661 1.727 0.085218 .
## thalach 0.004288 0.001051 4.079 5.83e-05 ***
## exang -0.230402 0.050611 -4.552 7.76e-06 ***
## oldpeak -0.083160 0.020302 -4.096 5.43e-05 ***
## ca -0.113123 0.021789 -5.192 3.89e-07 ***
## thal -0.139120 0.036711 -3.790 0.000183 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1363964)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 40.237 on 295 degrees of freedom
## AIC: 266.14
##
## Number of Fisher Scoring iterations: 2
fit6 <- glm(target ~ sex + thalach + exang + oldpeak + ca + thal, data=heart)
summary(fit6)
##
## Call:
## glm(formula = target ~ sex + thalach + exang + oldpeak + ca +
## thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.03497 -0.23209 0.07058 0.25171 0.91382
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.585156 0.186861 3.132 0.001913 **
## sex -0.169911 0.047238 -3.597 0.000377 ***
## thalach 0.004291 0.001055 4.068 6.10e-05 ***
## exang -0.234577 0.050722 -4.625 5.61e-06 ***
## oldpeak -0.084143 0.020362 -4.132 4.68e-05 ***
## ca -0.115177 0.021830 -5.276 2.55e-07 ***
## thal -0.137677 0.036824 -3.739 0.000222 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.13731)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 40.644 on 296 degrees of freedom
## AIC: 267.18
##
## Number of Fisher Scoring iterations: 2
fit7 <- glm(target ~ exang + oldpeak + ca + thal, data=heart)
summary(fit7)
##
## Call:
## glm(formula = target ~ exang + oldpeak + ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.90232 -0.26120 0.09768 0.25241 0.84291
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.21179 0.08708 13.916 < 2e-16 ***
## exang -0.31350 0.05011 -6.256 1.37e-09 ***
## oldpeak -0.10509 0.02062 -5.096 6.17e-07 ***
## ca -0.13378 0.02247 -5.953 7.40e-09 ***
## thal -0.15473 0.03784 -4.090 5.56e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1495234)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 44.558 on 298 degrees of freedom
## AIC: 291.04
##
## Number of Fisher Scoring iterations: 2
fit8 <- glm(target ~ sex + cp + restecg + exang + oldpeak + slope + ca + thal, data=heart)
summary(fit8)
##
## Call:
## glm(formula = target ~ sex + cp + restecg + exang + oldpeak +
## slope + ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.02011 -0.23353 0.04055 0.25366 0.86995
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.86520 0.11354 7.620 3.51e-13 ***
## sex -0.17303 0.04581 -3.777 0.000192 ***
## cp 0.12005 0.02208 5.437 1.14e-07 ***
## restecg 0.06084 0.03960 1.536 0.125547
## exang -0.18261 0.05035 -3.627 0.000338 ***
## oldpeak -0.07129 0.02282 -3.124 0.001961 **
## slope 0.10580 0.04157 2.545 0.011436 *
## ca -0.11364 0.02119 -5.363 1.66e-07 ***
## thal -0.12191 0.03576 -3.409 0.000742 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1287031)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 37.839 on 294 degrees of freedom
## AIC: 249.52
##
## Number of Fisher Scoring iterations: 2
fit9 <- glm(target ~ sex + cp + thalach + exang + oldpeak + ca + thal, data=heart)
summary(fit9)
##
## Call:
## glm(formula = target ~ sex + cp + thalach + exang + oldpeak +
## ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.90803 -0.22814 0.06006 0.23466 0.91956
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.536499 0.180215 2.977 0.003152 **
## sex -0.176876 0.045511 -3.886 0.000126 ***
## cp 0.109313 0.022223 4.919 1.45e-06 ***
## thalach 0.003518 0.001028 3.423 0.000707 ***
## exang -0.157643 0.051287 -3.074 0.002312 **
## oldpeak -0.087547 0.019620 -4.462 1.16e-05 ***
## ca -0.103037 0.021166 -4.868 1.84e-06 ***
## thal -0.123476 0.035578 -3.471 0.000597 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1273315)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 37.563 on 295 degrees of freedom
## AIC: 245.3
##
## Number of Fisher Scoring iterations: 2
fit10 <- glm(target ~ sex + cp + thalach + oldpeak + ca + thal, data=heart)
summary(fit10)
##
## Call:
## glm(formula = target ~ sex + cp + thalach + oldpeak + ca + thal,
## data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.89971 -0.23071 0.05203 0.24691 0.89302
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.391995 0.176440 2.222 0.027060 *
## sex -0.190920 0.045923 -4.157 4.22e-05 ***
## cp 0.130143 0.021464 6.063 4.06e-09 ***
## thalach 0.004294 0.001011 4.249 2.87e-05 ***
## oldpeak -0.096725 0.019667 -4.918 1.45e-06 ***
## ca -0.099790 0.021439 -4.655 4.91e-06 ***
## thal -0.134925 0.035884 -3.760 0.000205 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1309655)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 38.766 on 296 degrees of freedom
## AIC: 252.85
##
## Number of Fisher Scoring iterations: 2
fit11 <- glm(target ~ age + sex + cp + restecg + thalach + exang + oldpeak + slope + ca + thal, data=heart)
summary(fit11)
##
## Call:
## glm(formula = target ~ age + sex + cp + restecg + thalach + exang +
## oldpeak + slope + ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.92803 -0.20286 0.04837 0.25043 0.92813
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.608348 0.266863 2.280 0.023351 *
## age -0.002194 0.002571 -0.853 0.394195
## sex -0.182219 0.045877 -3.972 8.99e-05 ***
## cp 0.111412 0.022140 5.032 8.49e-07 ***
## restecg 0.059155 0.039365 1.503 0.133996
## thalach 0.002744 0.001118 2.454 0.014720 *
## exang -0.151054 0.051117 -2.955 0.003380 **
## oldpeak -0.064410 0.022672 -2.841 0.004815 **
## slope 0.077654 0.042243 1.838 0.067035 .
## ca -0.100830 0.021660 -4.655 4.92e-06 ***
## thal -0.124664 0.035380 -3.524 0.000494 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1255892)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 36.672 on 292 degrees of freedom
## AIC: 244.03
##
## Number of Fisher Scoring iterations: 2
fit12 <- glm(target ~ sex + cp + restecg + thalach + exang + oldpeak + slope + ca + thal, data=heart)
summary(fit12)
##
## Call:
## glm(formula = target ~ sex + cp + restecg + thalach + exang +
## oldpeak + slope + ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.93689 -0.20256 0.05328 0.25246 0.91571
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.442520 0.182804 2.421 0.016097 *
## sex -0.175852 0.045245 -3.887 0.000126 ***
## cp 0.110030 0.022070 4.986 1.06e-06 ***
## restecg 0.062853 0.039108 1.607 0.109097
## thalach 0.003072 0.001049 2.927 0.003687 **
## exang -0.148896 0.051030 -2.918 0.003798 **
## oldpeak -0.065668 0.022614 -2.904 0.003966 **
## slope 0.076914 0.042214 1.822 0.069474 .
## ca -0.104820 0.021140 -4.958 1.21e-06 ***
## thal -0.125956 0.035331 -3.565 0.000425 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1254727)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 36.764 on 293 degrees of freedom
## AIC: 242.78
##
## Number of Fisher Scoring iterations: 2
fit13 <- glm(target ~ sex + cp + restecg + thalach + exang + oldpeak + slope + ca + thal, data=heart)
summary(fit13)
##
## Call:
## glm(formula = target ~ sex + cp + restecg + thalach + exang +
## oldpeak + slope + ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.93689 -0.20256 0.05328 0.25246 0.91571
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.442520 0.182804 2.421 0.016097 *
## sex -0.175852 0.045245 -3.887 0.000126 ***
## cp 0.110030 0.022070 4.986 1.06e-06 ***
## restecg 0.062853 0.039108 1.607 0.109097
## thalach 0.003072 0.001049 2.927 0.003687 **
## exang -0.148896 0.051030 -2.918 0.003798 **
## oldpeak -0.065668 0.022614 -2.904 0.003966 **
## slope 0.076914 0.042214 1.822 0.069474 .
## ca -0.104820 0.021140 -4.958 1.21e-06 ***
## thal -0.125956 0.035331 -3.565 0.000425 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1254727)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 36.764 on 293 degrees of freedom
## AIC: 242.78
##
## Number of Fisher Scoring iterations: 2
barplot(heart$sex)

fit14 <- glm(target ~ ca + thal, data=heart)
summary(fit14)
##
## Call:
## glm(formula = target ~ ca + thal, data = heart)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.2172 -0.3358 0.2574 0.2574 1.1728
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.21720 0.09843 12.367 < 2e-16 ***
## ca -0.16951 0.02490 -6.808 5.41e-11 ***
## thal -0.23730 0.04159 -5.706 2.77e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.1912959)
##
## Null deviance: 75.149 on 302 degrees of freedom
## Residual deviance: 57.389 on 300 degrees of freedom
## AIC: 363.72
##
## Number of Fisher Scoring iterations: 2
table(heart$sex)
##
## 0 1
## 96 207
sex <- (table(heart$sex))
barplot(sex, main = "Sex Distribution", xlab = " 0 = Female and 1 = Male")

table(heart$target)
##
## 0 1
## 138 165
heartdisease <- (table(heart$target))
barplot(heartdisease, main = "Presence of Heart Disease", xlab = "0 = no heart disease and 1 = heart diease")
