dat <- read.csv("/Users/yujuk/Desktop/dataset/heart.csv")
dat
## X biking smoking heart.disease
## 1 1 30.801246 10.8966080 11.7694228
## 2 2 65.129215 2.2195632 2.8540815
## 3 3 1.959665 17.5883305 17.1778035
## 4 4 44.800196 2.8025589 6.8166469
## 5 5 69.428454 15.9745046 4.0622235
## 6 6 54.403626 29.3331755 9.5500460
## 7 7 49.056162 9.0608458 7.6245070
## 8 8 4.784604 12.8350208 15.8546544
## 9 9 65.730788 11.9912973 3.0674617
## 10 10 35.257449 23.2776834 12.0984844
## 11 11 51.825567 14.4351184 6.4302482
## 12 12 52.936197 25.0748686 8.6082721
## 13 13 48.767478 11.0232710 6.7225238
## 14 14 26.166801 6.6457495 10.5978071
## 15 15 10.553075 5.9905063 14.0794783
## 16 16 47.163716 14.0978372 8.7448453
## 17 17 61.685256 16.8408167 5.4433420
## 18 18 33.944394 5.7585952 9.1623064
## 19 19 39.697624 12.6628694 9.7471858
## 20 20 63.124698 22.9174800 5.8582779
## 21 21 28.510129 14.8551064 11.7247416
## 22 22 18.525973 26.4049774 16.0281877
## 23 23 24.479470 26.9249607 15.0007154
## 24 24 18.358646 23.4319568 16.4882059
## 25 25 30.388184 16.9860864 12.3566075
## 26 26 52.985220 27.6890270 9.0884449
## 27 27 60.509448 3.9819621 3.2172143
## 28 28 45.247110 2.1374753 6.5937191
## 29 29 48.597044 10.3884264 6.6594202
## 30 30 25.139771 5.8363728 11.4829371
## 31 31 44.173095 3.9676057 7.9822275
## 32 32 61.146946 27.7834060 7.7224625
## 33 33 27.267898 16.8532932 12.1648167
## 34 34 49.527100 15.2497308 8.0274043
## 35 35 20.197206 10.3314895 13.4165474
## 36 36 18.811228 16.7534420 15.0873602
## 37 37 67.350765 23.8737268 5.2798634
## 38 38 29.904475 24.5845499 13.5076192
## 39 39 14.011760 21.0121418 15.9929864
## 40 40 45.815488 4.7161269 7.0406211
## 41 41 31.477251 22.1658255 13.2385262
## 42 42 17.108204 1.3528783 11.5357354
## 43 43 9.665082 3.5042963 12.8868168
## 44 44 23.933005 4.1858692 10.8944571
## 45 45 22.636301 13.6789828 13.4660327
## 46 46 27.247477 13.3797768 12.3288989
## 47 47 20.789602 19.4554286 14.4157831
## 48 48 46.613715 9.2493326 6.8093546
## 49 49 28.622632 12.4827339 11.3683650
## 50 50 21.127498 18.9413483 14.8253624
## 51 51 68.574349 1.8047036 0.6839264
## 52 52 41.684367 13.0672050 9.0888493
## 53 53 69.879593 17.3516599 4.2564834
## 54 54 9.817277 23.8189949 17.8341328
## 55 55 4.379280 20.6629713 17.4118109
## 56 56 28.610378 1.1479621 10.0558055
## 57 57 21.460016 22.9760018 15.0086341
## 58 58 27.601656 4.3883804 10.8936853
## 59 59 57.230504 12.8049999 5.3068180
## 60 60 26.397282 7.7639305 11.0243252
## 61 61 39.010480 0.7676801 8.7639297
## 62 62 11.527487 6.7396220 14.6003016
## 63 63 17.684287 8.2780091 13.8021255
## 64 64 19.935253 6.0764383 11.6320723
## 65 65 42.310040 8.4123966 7.4630017
## 66 66 1.119154 19.5503583 17.7101910
## 67 67 23.276821 14.3066349 13.2663850
## 68 68 14.965816 12.8691532 15.3003824
## 69 69 30.663350 16.6632038 11.7531562
## 70 70 22.925183 24.5987873 16.1991180
## 71 71 59.770308 8.7007692 5.6856819
## 72 72 70.456061 12.7407109 2.9059872
## 73 73 21.750385 18.8575107 14.1798442
## 74 74 49.360686 23.2094802 9.4660260
## 75 75 4.487242 23.4190000 18.7669334
## 76 76 14.693269 17.8743936 16.3479313
## 77 77 40.611628 25.9937106 12.0466432
## 78 78 8.764197 3.8990404 13.3730055
## 79 79 56.725412 16.1809774 6.7357709
## 80 80 60.551149 18.0652019 6.5167036
## 81 81 64.384893 10.5295309 4.5668945
## 82 82 20.262798 11.1787830 12.3790734
## 83 83 30.520086 12.4334774 11.1407355
## 84 84 30.461542 29.8608106 14.3299759
## 85 85 3.705894 21.4941886 17.8776920
## 86 86 15.082469 16.6152001 14.9359168
## 87 87 30.997842 29.0164264 13.7579867
## 88 88 14.625411 6.7983462 14.4789601
## 89 89 28.103061 14.7313505 12.7945549
## 90 90 34.680241 8.6381050 8.3317181
## 91 91 6.947463 26.1056583 18.6897979
## 92 92 26.860662 16.7194132 13.4876889
## 93 93 41.019323 12.9991873 10.2648899
## 94 94 31.932738 28.1828730 13.1737410
## 95 95 69.877147 26.3311967 6.0724855
## 96 96 63.029854 22.2471319 6.3567192
## 97 97 21.349999 12.8558535 13.7996830
## 98 98 3.811338 17.7237882 18.4623513
## 99 99 67.514106 26.9553999 6.5826851
## 100 100 12.580893 16.9897825 14.8556848
## 101 101 61.232197 4.6135505 4.3616062
## 102 102 64.332304 29.4237378 7.7073976
## 103 103 31.872439 16.2418978 10.5260293
## 104 104 11.936562 3.4865672 14.3914484
## 105 105 52.360268 19.8410769 7.8163886
## 106 106 22.516638 7.6951729 11.6647648
## 107 107 49.764822 3.5729441 6.2645744
## 108 108 22.792636 9.8168286 10.9117655
## 109 109 49.748748 20.4918307 8.7001979
## 110 110 68.204122 2.1929445 1.9664482
## 111 111 15.185101 14.5203621 14.5878253
## 112 112 58.046901 15.7135850 6.5593358
## 113 113 69.499688 23.1678748 5.7536536
## 114 114 2.616135 4.3190804 14.8517766
## 115 115 2.136343 25.8401303 19.2426878
## 116 116 25.771571 28.5403473 14.4293485
## 117 117 11.615646 6.3455289 14.4114830
## 118 118 17.197456 20.7334559 15.1981843
## 119 119 27.681662 18.6370085 11.5075952
## 120 120 9.648096 8.3700383 15.5763683
## 121 121 65.621956 14.1066235 4.0442469
## 122 122 46.556228 26.8937498 10.5427902
## 123 123 48.300472 12.0117869 7.2992774
## 124 124 15.141292 7.8937497 13.6191300
## 125 125 71.579351 18.9378855 4.0907648
## 126 126 4.681250 10.9882819 15.8685828
## 127 127 22.476723 25.9723233 14.8303440
## 128 128 49.296201 5.0887881 6.0737923
## 129 129 17.648135 27.1925636 15.1389680
## 130 130 9.413778 8.6085378 13.5250712
## 131 131 64.915668 10.8893906 3.7743880
## 132 132 3.950367 6.3595796 14.6357693
## 133 133 67.342457 16.6226193 3.7444984
## 134 134 71.238955 25.1941518 6.0015227
## 135 135 70.323878 26.2334743 5.2357312
## 136 136 28.424901 20.2084485 13.0038423
## 137 137 73.713732 14.1016522 2.9890677
## 138 138 56.058032 8.2061159 5.5239310
## 139 139 21.588199 2.5734949 11.3742898
## 140 140 16.276161 3.4634491 13.5987547
## 141 141 26.988690 15.8833260 12.9216726
## 142 142 11.326814 9.2306549 14.5243489
## 143 143 55.580584 7.6713074 5.7268270
## 144 144 50.603802 28.9184712 10.6355905
## 145 145 60.401739 24.8321410 7.5726142
## 146 146 71.486751 21.6373684 3.6684273
## 147 147 37.978507 13.9453443 10.1067938
## 148 148 48.692115 23.5640881 9.5990941
## 149 149 40.016400 7.8116349 7.6581870
## 150 150 32.148553 0.9690843 8.8739847
## 151 151 12.318283 26.8908058 17.7585948
## 152 152 31.659667 21.3995087 12.0931244
## 153 153 55.841893 2.2487162 4.5002273
## 154 154 28.826953 11.4098666 12.8126371
## 155 155 55.472287 5.2674378 4.9163834
## 156 156 54.354034 16.3415202 7.5917973
## 157 157 70.331699 15.0588637 3.0374318
## 158 158 54.062609 20.3888136 8.0511951
## 159 159 59.575645 24.7926381 8.5199279
## 160 160 2.818204 23.2461405 18.4829598
## 161 161 30.460335 2.5256544 8.9365829
## 162 162 22.343450 23.2046425 15.9085493
## 163 163 14.696886 9.8316822 13.2582035
## 164 164 70.902815 29.9140032 6.3350215
## 165 165 35.335113 9.1475020 9.7518942
## 166 166 72.173766 15.2736628 2.8283567
## 167 167 44.698217 10.0025889 7.4494126
## 168 168 70.361366 20.3399150 3.8971099
## 169 169 7.619084 26.6615229 18.6881304
## 170 170 29.673634 2.3967956 9.3879078
## 171 171 28.485683 12.6628036 11.2860570
## 172 172 67.423291 28.6574311 5.8094945
## 173 173 10.145069 11.3175196 14.8048065
## 174 174 59.989904 25.4558391 7.4743720
## 175 175 38.155015 20.1042221 11.5622808
## 176 176 15.466010 11.5711484 13.3774300
## 177 177 73.767713 16.1513316 2.3548085
## 178 178 31.179629 5.5684413 9.8617288
## 179 179 5.201611 4.3599032 15.6431142
## 180 180 50.249614 4.1290591 5.5419066
## 181 181 60.940141 21.8644959 5.4159174
## 182 182 20.068674 11.9294173 12.6884954
## 183 183 41.211215 4.1514402 7.5901660
## 184 184 72.394856 7.5198372 1.8701100
## 185 185 10.610969 19.3015155 16.7460356
## 186 186 45.579836 20.6168515 9.7984834
## 187 187 29.658506 12.1518990 12.8178071
## 188 188 40.056854 16.5064944 9.3926393
## 189 189 5.510300 17.8842193 16.0139209
## 190 190 32.056529 12.4794809 11.5360652
## 191 191 46.842870 27.3216486 10.2505847
## 192 192 42.425007 10.9547394 8.8282361
## 193 193 31.212374 7.7973828 9.7753859
## 194 194 13.176628 9.9874669 14.5477545
## 195 195 33.779739 0.9653903 6.9442975
## 196 196 70.690083 22.7107707 2.7084606
## 197 197 60.284951 15.1081402 4.9479908
## 198 198 16.003605 19.8941489 15.3662877
## 199 199 39.677219 10.2721672 9.5436557
## 200 200 12.885185 25.2101825 16.2725863
## 201 201 35.023450 22.6640373 12.5158362
## 202 202 10.343753 27.6468493 17.4485160
## 203 203 20.640893 15.3841384 14.5572879
## 204 204 63.238037 20.5047412 5.5609216
## 205 205 23.984565 7.6121169 11.5562573
## 206 206 44.014897 6.5796621 8.5037463
## 207 207 67.127924 5.8203635 2.5511506
## 208 208 36.538050 2.0528831 8.4950339
## 209 209 7.831481 26.8269709 17.5604514
## 210 210 40.395401 7.0274602 6.7390807
## 211 211 16.249914 28.3617369 17.3545771
## 212 212 47.584661 29.4683524 11.5999032
## 213 213 15.481362 18.8152012 14.9407560
## 214 214 70.085196 10.3826455 2.2392169
## 215 215 1.330485 28.7937440 20.4534962
## 216 216 61.542692 12.8374854 4.9734613
## 217 217 23.097771 0.9073611 10.6947889
## 218 218 65.069917 1.4876797 2.1856508
## 219 219 71.014542 15.2819055 4.0768235
## 220 220 64.065982 28.4724464 7.2862524
## 221 221 61.152760 2.1900536 3.5229763
## 222 222 22.672368 28.7353995 16.7786346
## 223 223 49.728740 3.4945424 5.0730746
## 224 224 35.480794 15.8501562 11.3729971
## 225 225 59.461885 18.8075341 5.6906489
## 226 226 31.697593 23.1906637 12.5378281
## 227 227 62.772108 15.2398175 4.9345783
## 228 228 58.668542 19.5857407 6.6620753
## 229 229 25.254140 7.1689519 12.0465147
## 230 230 22.722701 8.2882507 11.2963162
## 231 231 1.616922 1.4584368 16.3351186
## 232 232 10.353648 16.0131718 14.0886540
## 233 233 44.721586 7.2730788 7.6450248
## 234 234 29.224098 27.3570273 13.6443726
## 235 235 66.111593 18.6293941 4.5900481
## 236 236 46.728488 8.4995461 7.8255359
## 237 237 39.172427 17.5563764 10.7150869
## 238 238 9.937617 22.3426031 16.3846780
## 239 239 61.393845 22.9195492 6.8381847
## 240 240 21.608228 9.3488357 13.9959895
## 241 241 6.283610 20.1753293 17.5981661
## 242 242 61.436136 24.4659138 7.6206629
## 243 243 1.257841 15.1309519 16.7368633
## 244 244 4.699863 9.8599366 15.5694793
## 245 245 54.938223 13.0462165 6.2944988
## 246 246 7.749030 8.3870192 13.2815287
## 247 247 49.563424 16.2590213 8.1434851
## 248 248 29.731403 23.3339016 12.9964758
## 249 249 45.716267 23.8302604 9.2300743
## 250 250 47.537321 20.0742953 8.9378932
## 251 251 35.726016 8.9157682 10.5460251
## 252 252 35.912251 18.5148365 11.4380100
## 253 253 26.919990 11.5309853 12.1611678
## 254 254 34.162508 24.4145881 13.2060430
## 255 255 51.900538 27.3240290 9.5946227
## 256 256 73.143146 11.2752757 1.6857227
## 257 257 52.550886 13.8796797 7.4925558
## 258 258 10.664014 16.4896077 15.4418923
## 259 259 34.634851 4.9226945 8.8961039
## 260 260 37.693189 26.2662579 11.1773178
## 261 261 72.421679 4.2488265 0.7121819
## 262 262 30.161485 6.6110456 9.8354744
## 263 263 67.121405 8.4784824 3.1181517
## 264 264 10.262000 26.8565236 17.1060395
## 265 265 17.525750 4.7638941 11.9488893
## 266 266 66.840014 0.5258500 0.9875364
## 267 267 70.299739 6.4237343 1.1048204
## 268 268 34.229590 17.7648414 11.2714178
## 269 269 42.594866 26.2857438 11.6009394
## 270 270 73.987237 16.9157391 3.8353451
## 271 271 69.310829 4.6557367 2.2016530
## 272 272 38.636658 18.2480098 9.5133839
## 273 273 24.699356 4.6039660 12.1074100
## 274 274 55.370253 17.2038510 7.2310693
## 275 275 32.170214 5.0175149 9.9049713
## 276 276 67.779633 15.1993371 4.6800975
## 277 277 16.057724 19.1118900 14.6563521
## 278 278 39.333217 15.1034692 9.3244739
## 279 279 37.665190 24.9718414 11.1056306
## 280 280 28.480246 17.3199216 11.7295703
## 281 281 73.932910 26.5264341 5.3340374
## 282 282 61.313971 16.8076136 4.8419280
## 283 283 67.822195 26.8826561 6.2617038
## 284 284 1.466301 28.2069104 20.1852906
## 285 285 61.925511 26.3258096 6.8571743
## 286 286 25.665004 23.2615382 13.6432671
## 287 287 36.237608 20.9340928 12.7512095
## 288 288 45.457607 25.7596081 10.8655224
## 289 289 49.022959 3.2280954 5.8429680
## 290 290 63.799428 29.1247242 7.6188035
## 291 291 4.470326 4.3553675 13.7798360
## 292 292 47.695866 28.3878511 10.1749400
## 293 293 4.341424 8.0329811 15.1727164
## 294 294 66.971620 24.2198387 5.7955982
## 295 295 34.032646 13.0622367 10.3819438
## 296 296 13.625346 1.4167141 11.8208854
## 297 297 54.821433 10.6239231 6.2237844
## 298 298 18.205567 15.9476017 13.9029794
## 299 299 51.692701 19.1996174 6.9520550
## 300 300 7.480637 19.4392335 16.6418807
## 301 301 47.355227 15.3457820 9.0957486
## 302 302 38.204290 23.5397917 11.7785962
## 303 303 33.742643 14.0819166 10.2335875
## 304 304 40.555015 2.7828646 6.5730508
## 305 305 70.208596 13.7516893 5.3190941
## 306 306 26.155009 7.4422319 12.3513903
## 307 307 17.751723 3.4824026 11.4296860
## 308 308 71.847044 13.0407691 2.0628619
## 309 309 60.021979 4.2868104 4.1138786
## 310 310 60.270390 8.7861543 4.5911728
## 311 311 33.922205 24.3928492 11.3852091
## 312 312 43.300519 8.2850748 6.5585796
## 313 313 22.891589 2.4011628 10.9717609
## 314 314 57.095671 3.2911638 4.6269659
## 315 315 40.124049 13.9695702 9.9049209
## 316 316 37.332538 12.7516464 10.7042342
## 317 317 32.634373 13.7179209 10.3775691
## 318 318 43.909341 26.0620820 11.4335113
## 319 319 15.489999 19.5430617 15.2399655
## 320 320 52.034081 16.2070389 8.2689831
## 321 321 3.960526 27.4715448 19.4319601
## 322 322 61.303891 15.4111217 5.4789087
## 323 323 56.367512 17.5203572 6.8083997
## 324 324 34.530051 16.7816632 10.7291815
## 325 325 70.950558 3.5211730 0.7049961
## 326 326 44.572771 17.1550494 8.3108977
## 327 327 9.816417 18.0027014 16.7913828
## 328 328 14.242695 26.7242731 17.3705338
## 329 329 15.137385 3.2812824 12.7344968
## 330 330 39.905489 19.7205943 8.8858633
## 331 331 13.730690 14.2177350 14.2983625
## 332 332 51.563683 23.3450455 8.5490950
## 333 333 74.011080 18.8543469 3.2962178
## 334 334 13.939865 27.2540442 15.9893714
## 335 335 36.374862 25.3954955 11.6298290
## 336 336 14.732989 19.4709192 14.4080750
## 337 337 6.178654 15.5468701 15.9778522
## 338 338 8.128956 5.8893583 14.4437737
## 339 339 9.727759 15.2972538 15.5885430
## 340 340 20.226774 28.1769618 16.5178715
## 341 341 46.020846 18.0521329 9.2319707
## 342 342 33.284619 17.3050400 11.2694843
## 343 343 19.909001 19.0605707 14.4660128
## 344 344 8.633643 4.3829289 14.4858121
## 345 345 50.898031 29.8252593 10.8115183
## 346 346 1.576452 9.0612731 14.4343940
## 347 347 10.389193 23.6915083 16.9616280
## 348 348 28.896313 24.2375831 13.7241183
## 349 349 68.029425 13.2735594 4.0660948
## 350 350 5.471788 16.0808894 17.6180620
## 351 351 48.777851 27.7454919 8.9976366
## 352 352 61.356691 17.9649971 4.9460902
## 353 353 64.173931 19.0373520 6.0609886
## 354 354 2.977160 3.8397647 15.1627752
## 355 355 69.992342 20.2625714 3.6893645
## 356 356 65.963766 3.5069213 2.7186641
## 357 357 19.374553 6.1153180 11.5437192
## 358 358 57.995069 16.3960303 5.7177334
## 359 359 9.661735 4.3501964 13.6273518
## 360 360 24.953993 23.2441339 13.6705821
## 361 361 62.061052 21.2032056 6.7150779
## 362 362 49.888796 3.8610316 5.3261272
## 363 363 69.776191 20.2866413 4.5242760
## 364 364 29.578742 18.7836006 11.8311383
## 365 365 59.869018 22.8854866 7.3223322
## 366 366 19.071488 27.0881800 16.6098257
## 367 367 20.803894 5.2645876 11.0583055
## 368 368 2.633935 18.3404030 16.3756622
## 369 369 39.944085 14.5277596 10.0490669
## 370 370 48.547680 5.0688691 6.5079475
## 371 371 26.332030 26.6869350 15.1165636
## 372 372 15.347194 22.4262563 17.2692334
## 373 373 74.583779 16.1937408 2.9116599
## 374 374 61.534993 17.0459635 5.9054458
## 375 375 19.651335 1.3962618 11.7697859
## 376 376 23.315546 20.6625244 13.7515775
## 377 377 14.700212 28.3058238 17.0171583
## 378 378 13.377701 29.6848021 17.2139369
## 379 379 32.484626 25.2504638 13.1917033
## 380 380 39.246899 15.3416817 10.3885655
## 381 381 8.522310 29.9467431 17.8578487
## 382 382 37.177187 22.3559719 10.5036890
## 383 383 70.700683 19.0571762 2.8284841
## 384 384 68.212733 15.3178344 4.4809930
## 385 385 31.714463 28.7458214 13.0160451
## 386 386 65.201713 24.2065845 7.1849464
## 387 387 64.376918 29.2571132 7.3303757
## 388 388 67.256755 15.0187118 4.6315166
## 389 389 21.537676 4.7600703 10.3661423
## 390 390 63.596727 12.5153904 3.4530267
## 391 391 39.993010 14.5087353 9.5094184
## 392 392 70.578968 11.2198596 2.6547061
## 393 393 54.101324 25.9821230 8.8541074
## 394 394 22.358288 21.6506575 15.0308207
## 395 395 60.584615 6.4720628 3.3491379
## 396 396 61.296241 4.2479007 3.3978433
## 397 397 41.443284 5.1569665 7.1491787
## 398 398 58.430433 0.7342280 3.2338332
## 399 399 71.670317 0.9415583 0.5546971
## 400 400 61.008149 7.6460379 3.5986787
## 401 401 69.671782 24.9687638 5.8505170
## 402 402 19.313206 29.6571442 16.2651030
## 403 403 38.166865 4.2476656 7.2579462
## 404 404 24.760319 6.5129285 11.5776716
## 405 405 12.949559 27.0340559 18.6396922
## 406 406 17.966363 26.8311231 16.1647939
## 407 407 4.158496 19.6597161 17.0589359
## 408 408 50.837966 20.0001457 7.9306012
## 409 409 8.796572 16.5032820 16.5272933
## 410 410 27.423996 18.2377258 11.5944099
## 411 411 5.782733 6.8057129 15.8369336
## 412 412 4.445668 27.3295368 18.6734573
## 413 413 30.120726 29.3418945 14.9898130
## 414 414 29.047920 29.2027903 13.7702316
## 415 415 26.723292 11.5928445 11.4241149
## 416 416 38.116560 17.0259702 8.3455735
## 417 417 45.859855 2.6209658 5.8095431
## 418 418 62.021049 23.8830499 6.9595020
## 419 419 6.057336 14.2552872 17.1337446
## 420 420 4.731341 24.1359724 19.5817260
## 421 421 25.767234 19.8270986 13.1750007
## 422 422 25.906997 16.1600287 13.6480773
## 423 423 71.930577 19.4163691 4.1132188
## 424 424 57.978406 20.5598091 7.5006118
## 425 425 21.822555 15.5006589 13.3798074
## 426 426 15.371938 23.4066160 14.0716450
## 427 427 67.471759 14.6354724 4.6955205
## 428 428 64.485419 5.8788732 2.9787686
## 429 429 35.736667 9.3960224 9.5718912
## 430 430 6.324214 5.2075066 14.8081496
## 431 431 64.033751 29.5593251 8.5705833
## 432 432 66.015502 13.5683691 4.1847701
## 433 433 3.220291 9.1764671 16.4996389
## 434 434 36.328194 8.2483419 9.7801651
## 435 435 29.866576 2.3942733 9.4468988
## 436 436 57.475925 15.7790716 6.0360129
## 437 437 18.126784 10.7587843 13.3344281
## 438 438 31.847309 22.1871573 13.2836703
## 439 439 63.753105 9.9062485 3.4020804
## 440 440 30.519444 18.1421048 11.6585708
## 441 441 74.205816 9.2990963 1.5734290
## 442 442 33.020247 0.6817504 8.5578541
## 443 443 22.530761 16.3310107 13.7196390
## 444 444 2.010308 1.7517191 14.0074901
## 445 445 11.099022 17.5277122 14.8979609
## 446 446 25.301649 18.1137812 13.1931753
## 447 447 33.157137 17.5565039 12.0628147
## 448 448 28.569941 15.9952260 12.0749260
## 449 449 60.031747 11.3688387 5.0722812
## 450 450 18.951146 13.9546247 13.4705063
## 451 451 24.727982 25.6012842 13.7237396
## 452 452 74.907111 5.6959430 1.0944887
## 453 453 10.530125 14.9603882 15.5819986
## 454 454 74.210494 22.5850200 4.2963770
## 455 455 36.290536 25.2679184 12.5665225
## 456 456 55.198777 15.3344487 7.0159902
## 457 457 57.044609 9.6842191 5.7281349
## 458 458 68.658906 22.4306836 5.3569752
## 459 459 40.317458 1.6025254 6.7852343
## 460 460 31.417332 8.1845130 9.7932399
## 461 461 71.440415 12.8449456 3.2634022
## 462 462 34.836579 29.8244807 13.3703392
## 463 463 39.349849 13.6011709 8.8679251
## 464 464 73.848167 0.6420440 0.5518982
## 465 465 40.764848 11.5974803 8.4629523
## 466 466 60.630416 23.7849810 5.9764276
## 467 467 74.508779 22.5206403 4.3031890
## 468 468 56.210806 19.2488506 6.5126756
## 469 469 11.658029 26.7341762 17.4739403
## 470 470 6.295051 19.4351915 17.7621148
## 471 471 60.587355 8.1735868 4.9380589
## 472 472 56.151543 28.3524443 10.1612021
## 473 473 74.221991 26.0782411 4.6313983
## 474 474 25.443047 13.2003989 12.3580352
## 475 475 36.368318 23.6979059 11.2829462
## 476 476 25.887693 8.1590235 10.8874134
## 477 477 59.350253 20.3678154 7.6653459
## 478 478 11.883447 1.1427967 12.7884505
## 479 479 4.817058 27.5778350 18.5036637
## 480 480 7.582143 29.6442147 18.0812684
## 481 481 54.181002 5.9596483 5.3516192
## 482 482 33.262015 6.8121297 10.3723287
## 483 483 36.086220 13.7865545 9.7315448
## 484 484 55.663943 14.9632192 6.9162586
## 485 485 22.719661 1.0247563 10.8938936
## 486 486 41.178991 7.5752679 7.8313847
## 487 487 22.021893 19.4992577 13.7706394
## 488 488 69.927963 25.9843899 6.7560155
## 489 489 41.642072 0.5330593 5.9256803
## 490 490 70.194411 16.2928029 4.7070094
## 491 491 50.831908 6.0260661 5.5854932
## 492 492 68.884065 10.5429959 3.1093377
## 493 493 21.599230 7.6043297 12.3736910
## 494 494 47.660440 27.5624638 11.2943916
## 495 495 45.097203 21.3856201 9.6167625
## 496 496 8.279743 6.4237195 13.4951677
## 497 497 42.345863 20.7413275 10.1158651
## 498 498 30.774254 23.6101750 11.8435558
#independent variables: biking and smoking
#dependent variable: heart disease
str(dat)
## 'data.frame': 498 obs. of 4 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ biking : num 30.8 65.13 1.96 44.8 69.43 ...
## $ smoking : num 10.9 2.22 17.59 2.8 15.97 ...
## $ heart.disease: num 11.77 2.85 17.18 6.82 4.06 ...
View(dat)
head(dat)
## X biking smoking heart.disease
## 1 1 30.801246 10.896608 11.769423
## 2 2 65.129215 2.219563 2.854081
## 3 3 1.959665 17.588331 17.177803
## 4 4 44.800196 2.802559 6.816647
## 5 5 69.428454 15.974505 4.062224
## 6 6 54.403626 29.333176 9.550046
tail(dat)
## X biking smoking heart.disease
## 493 493 21.599230 7.60433 12.373691
## 494 494 47.660440 27.56246 11.294392
## 495 495 45.097203 21.38562 9.616762
## 496 496 8.279743 6.42372 13.495168
## 497 497 42.345863 20.74133 10.115865
## 498 498 30.774254 23.61017 11.843556
model<- lm(heart.disease ~ biking+smoking, data = dat)
summary(model)
##
## Call:
## lm(formula = heart.disease ~ biking + smoking, data = dat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.1789 -0.4463 0.0362 0.4422 1.9331
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 14.984658 0.080137 186.99 <2e-16 ***
## biking -0.200133 0.001366 -146.53 <2e-16 ***
## smoking 0.178334 0.003539 50.39 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.654 on 495 degrees of freedom
## Multiple R-squared: 0.9796, Adjusted R-squared: 0.9795
## F-statistic: 1.19e+04 on 2 and 495 DF, p-value: < 2.2e-16
```
#The relationship between Heart Disease and each predictor variable of biking and smoking were statistically significant.
#Effect of each predictor when others are held constant.
#biking (b= -0.200133) For each additional biking, heart disease decreases by 0.200 units, with smoking held constant.
#smoking (b= 0.178334) For each additional smoking, heart disease increases by 0.178 units, with biking held constant.