-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitialresults_CIND820.Rmd
2071 lines (1728 loc) · 82.6 KB
/
initialresults_CIND820.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: Initial Results and Code for CIND820
output: file:///E:/Data_Analytics/Final%20Project/BRFSS/BRFSS_2015/initialresults_CIND820.html
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
```
```{r}
#install.packages("DescTools")
#install.packages("rcompanion") #posthoc chi-square test
#install.packages("FSA")
#install.packages("rstatix")
#install.packages("FSinR")
#install.packages("arules")
#install.packages("arulesViz")
#install.packages("psych")
#install.packages("vcd")
#install.packages("samplesizeCMH")
#install.packages("reshape2")
#install.packages("caret")
#install.packages("naivebayes")
#install.packages("nnet")
#install.packages("randomForest")
#install.packages("ROSE")
#install.packages("ranger")
#install.packages("parsnip")
#install.packages("e1071")
#install.packages("neuralnet")
#install.packages("caTools")
#install.packages("Metrics")
#install.packages("mlr")
#install.packages("Boruta")
#install.packages("tuneRanger")
#install.packages("tidyverse")
#install.packages("leaps")
#install.packages("RCurl")
```
```{r}
library(tidyverse) #utility functions
library(readxl) #reading xml files
library(jsonlite) # reading json
library(DescTools) #Cramer's V and CMH test
library(rcompanion) #posthoc chi square and CMH tests
library(vcd)
library(psych) #CMH tests
library(rstatix)
library(reshape2)
library(ggplot2) #graphs etc
library(reshape2) #melting for cm matrix
library(corrplot)
library(car)
library(mlbench) #feature selection
library(caret) # feature selection
library(FSinR) #GINI index
library(MASS) # stepwise regression
library(leaps) # all subsets regression
library(RCurl) #regression
library(party) # decision tree
library(arules) #association rules
library(arulesViz) #association rules
library(cluster) #graphing k-means clusters
#install.packages("fpc")
library(fpc) #graphing k-means clusters
library(randomForest)
library(strucchange) #sig of decision tree
```
Loading the cleaned dataset from 'data_cleaning_descriptivestats_CIND820' to the local environment.
```{r}
data <- read.csv(file="C:/Users/mmkea/Documents/brfss_2015_data_clean.csv",
stringsAsFactors=FALSE,
na.strings=c("","NA"))
```
```{r}
str(data)
```
Now, we'll start our exploratory analysis with bivariate analyses to compare categorical and numerical variables across “good or better” and “fair or worse” levels of self-reported general health.
For categorical variables, Chi-squared tests will be performed for statistical significance and Cramer’s V tests will be performed for effect sizes. For numeric variables, non-parametric Mann-Whitney tests will be performed for statistical significance and Wilcoxon effect size tests for effect sizes.
Due to the size of the dataset, variables will be considered significantly different across levels of self-reported general health when the result likelihood is less than 1% (p < 0.01) and the effect size is small or greater (effect > 0.1).
SEX V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic characteristics. SEX.
freq_data <- table(data$X_RFHLTH, data$SEX)
colnames(freq_data) <- c("Male", "Female")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) #p > 0.01
CramerV(freq_data) #negligible effect size.
barplot(freq_data,
ylab="Frequency",
ylim=c(0,80000),
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
The effect size between sex and general health is negligible and the results will not be considered significant.
MARITAL V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic characteristics. MARITAL.
freq_data <- table(data$X_RFHLTH, data$MARITAL)
colnames(freq_data) <- c("Married", "Divorced", "Widowed", "Separated",
"Never Married", "Common Law")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq)
CramerV(freq_data) #small effect
#Post-hocs.
freq_data_ph <- table(data$MARITAL, data$X_RFHLTH)
rownames(freq_data_ph) <- c("Married", "Divorced", "Widowed", "Separated",
"Never\nMarried", "Common\nLaw")
colnames(freq_data_ph)<-c("Good or Better", "Fair or Worse")
pairwiseNominalIndependence(freq_data_ph,
fisher=FALSE,
gtest=FALSE,
chisq=TRUE,
method="fdr")
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
las=2,
beside=TRUE,
legend.text = TRUE)
```
General health was significantly different across marital status (χ2 = 2480, p < 0.01). Cramer’s V test of effect size demonstrated a small effect between marital status and general health (V = 0.12). Adjusted post-hoc tests revealed that, except for common-law individuals, married individuals had significantly higher proportions of good or better health compared to divorced, widowed, separated, and never married individuals (p < 0.01). As well, individuals who were separated had significantly higher proportions of fair or worse health compared to the other groups (p < 0.01).
ETHNICITY V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic characteristics. X_RACE.
freq_data <- table(data$X_RFHLTH, data$X_RACE)
colnames(freq_data) <- c("White", "Black", "Native", "Asian", "Native Islander","Other","Multiracial", "Hispanic")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #small
#Pairwise tests.
freq_data_ph <- table(data$X_RACE, data$X_RFHLTH)
rownames(freq_data_ph) <- c("White", "Black", "Native", "Asian", "Native\nIslander","Other","Multiracial", "Hispanic")
colnames(freq_data_ph)<-c("Good or Better", "Fair or Worse")
pairwiseNominalIndependence(freq_data_ph,
fisher=FALSE,
gtest=FALSE,
chisq=TRUE,
method="fdr")
barplot(freq_data,
las=2,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
General health is significantly different across ethnicity groups (χ2 = 4189, p < 0.01). Cramer’s V test of effect size demonstrated a small effect between ethnicity and general health (V = 0.15). Adjusted post-hoc tests revealed that Caucasian and Asian individuals had significantly higher proportions of good health compared to African American, Native American, Multiracial, and Hispanic individuals (p < 0.01).
AGE V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic characteristics. X_AGEG5YR.
freq_data <- table(data$X_RFHLTH, data$X_AGEG5YR)
colnames(freq_data) <- c("60-64", "65-69", "70-74","75-79", "80+")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #negligible
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
The effect size between age and general health is negligible and the results will not be considered significant.
EDUCATION V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic characteristics. X_EDUCAG.
freq_data <- table(data$X_RFHLTH, data$X_EDUCAG)
colnames(freq_data) <- c("No HS\nDiploma", "HS\nDiploma","Attended\nCollege", "College\nDiploma")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #small
#Pairwise tests.
freq_data_ph <- table(data$X_EDUCAG, data$X_RFHLTH)
rownames(freq_data_ph) <- c("No HS\nDiploma", "HS\nDiploma","Attended\nCollege", "College\nDiploma")
colnames(freq_data_ph)<-c("Good or Better", "Fair or Worse")
pairwiseNominalIndependence(freq_data_ph,
fisher=FALSE,
gtest=FALSE,
chisq=TRUE,
method="fdr")
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
General health is significantly different across education levels (χ2 = 10372, p < 0.01). Cramer’s V test of effect size demonstrated a small effect between education and general health (V = 0.24). Adjusted post-hoc tests demonstrated that individuals with no high school diploma had significantly higher proportions of fair or worse health compared to other education levels (p < 0.01).
EMPLOYMENT V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic characteristics. EMPLOY1.
freq_data <- table(data$X_RFHLTH, data$EMPLOY1)
colnames(freq_data) <- c("Employed", "Not\nEmployed", "Retired","Other")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #small
#Pairwise tests.
freq_data_ph <- table(data$EMPLOY1, data$X_RFHLTH)
rownames(freq_data_ph) <- c("Employed", "Not\nEmployed", "Retired","Other")
colnames(freq_data_ph)<-c("Good or Better", "Fair or Worse")
pairwiseNominalIndependence(freq_data_ph,
fisher=FALSE,
gtest=FALSE,
chisq=TRUE,
method="fdr")
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
General health is significantly different across employment status (χ2 = 15530, p < 0.01). Cramer’s V test of effect size demonstrated a small-to-medium effect between education and general health (V = 0.29). Adjusted post-hoc tests revealed that unemployed individuals had significantly higher proportions of fair or worse health compared to individuals who responded with employed, retired, and other (eg, homemaker and students; p < 0.01; Figure TK). Employed individuals also had significantly higher proportions of good or better health compared to the other groups (p < 0.01).
INCOME V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic characteristics. INCOME.
freq_data <- table(data$X_RFHLTH, data$INCOME2)
colnames(freq_data) <- c("No\nReport", "<10,000", "10-15,000", "15-20,000","20-25,000", "25-35,000", "35-50,000","50-75,000", ">75,000")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #small
#Pairwise tests.
freq_data_ph <- table(data$INCOME2, data$X_RFHLTH)
rownames(freq_data_ph) <- c("No\nReport","<10,000", "10-15,000", "15-20,000","20-25,000", "25-35,000", "35-50,000","50-75,000", ">75,000")
colnames(freq_data_ph)<-c("Good or Better", "Fair or Worse")
pairwiseNominalIndependence(freq_data_ph,
fisher=FALSE,
gtest=FALSE,
chisq=TRUE,
method="fdr")
barplot(freq_data,
las=2,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
General health is significantly different across employment status (χ2 = 13542, p < 0.01). Cramer’s V test of effect size demonstrated a small-to-medium effect between income and general health (V = 0.27). Adjusted post-hoc tests revealed that as reported income increased in the population, there is a significant increase in the proportion of individuals with good or better health (p < 0.01).
VETERAN STATUS V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic characteristics. VETERAN3.
freq_data <- table(data$X_RFHLTH, data$VETERAN3)
colnames(freq_data) <- c("Veteran", "Non-Veteran")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Negligible. No interpretation.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
The effect size between veteran status and general health is negligible and the results will not be considered significant.
HEALTH PLANs V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic status. HLTHPLN1.
freq_data <- table(data$X_RFHLTH, data$HLTHPLN1)
colnames(freq_data) <- c("Yes", "No")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Negligible. No interpretation.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
The effect size between health plan status and general health is negligible and the results will not be considered significant.
MEDICAL COSTS V. GENERAL HEALTH.
```{r}
#Demographics. Socioeconomic status. MEDCOST.
freq_data <- table(data$X_RFHLTH, data$MEDCOST)
colnames(freq_data) <- c("Yes", "No")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
Respondents who were unable to see doctor because of medical costs had significantly higher proportions of fair or worse health compared to individuals who were able to see a doctor despite the costs (χ2 = 3383, p < 0.01, V = 0.13).
NUMBER OF ADULTS IN HOME V. GENERAL HEALTH.
```{r}
#Demographics. Living Situation. ADULT.
wilcox.test(data$X_RFHLTH, data$ADULT,
paired=FALSE, na.rm = TRUE) # p < 0.01
wilcox_effsize(data, ADULT ~ X_RFHLTH, na.rm=TRUE) #negligible
boxplot(formula=data$ADULT~data$X_RFHLTH,
ylab="Frequency",
main="Number of Adults",
col = c("salmon", "seagreen"),
beside=TRUE,
names=c("Good or Better", "Fair or Worse"))
```
The effect size between number of adults in the home and general health is negligible and the results will not be considered significant.
CHILDREN IN THE HOME V. GENERAL HEALTH.
```{r}
#Demographics. Living Situation. CHILDREN.
wilcox.test(data$X_RFHLTH, data$CHILDREN,
paired=FALSE, na.rm = TRUE) # p < 0.01
wilcox_effsize(data, CHILDREN ~ X_RFHLTH, na.rm=TRUE) # negligible
boxplot(formula=data$CHILDREN~data$X_RFHLTH,
ylab="Frequency",
main="Number of Children",
col = c("salmon", "seagreen"),
beside=TRUE,
names=c("Good or Better", "Fair or Worse"))
```
The effect size between number of children in the home and general health is negligible and the results will not be considered significant.
HOME OWNDERSHIP V. GENERAL HEALTH.
```{r}
#Demographics. Living Situation. RENTHOME1.
freq_data <- table(data$X_RFHLTH, data$RENTHOM1)
colnames(freq_data) <- c("Owns", "Doesn't Own")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #small
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE)
```
Individuals who owned their home had significantly higher proportions of good or better health compared to individuals who did not own their home (χ2 = 4383, p < 0.01). Cramer’s V test of effect size demonstrated a small effect between income and general health (V = 0.15).
BMI V. GENERAL HEALTH.
```{r}
#Demographics. Medical Characteristics. X_BMI5.
wilcox.test(data$X_RFHLTH, data$X_BMI5,
paired=FALSE, na.rm = TRUE) # p < 0.01
wilcox_effsize(data, X_BMI5 ~ X_RFHLTH, na.rm=TRUE) #small
md = mean(data$X_BMI5[data$X_RFHLTH==1], na.rm=TRUE) - mean(data$X_BMI5[data$X_RFHLTH==2], na.rm=TRUE)
print(md)
boxplot(formula=data$X_BMI5~data$X_RFHLTH,
ylab="Frequency",
main="BMI",
col = c("salmon", "seagreen"),
beside=TRUE,
names=c("Good or Better", "Fair or Worse"))
```
Individuals who report good or better health have significantly lower BMI compared to individuals who report fair or worse health (MD = -1.79, W = 0, p < 0.01). The Wilcoxon test of effect size demonstrated a small effect between BMI and general health (r = 0.11).
BLOOD PRESSURE V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. X_RFHYPE5.
#People with normal blood pressure have higher proportions of
#good or better health.
freq_data <- table(data$X_RFHLTH, data$X_RFHYPE5)
colnames(freq_data) <- c("Normal\nBlood Pressure", "High\nBlood Pressure")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of high blood pressure (χ2 = 5059, p < 0.01, V = 0.17).
CHOLESTEROL LEVELS V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. X_RFCHOL.
freq_data <- table(data$X_RFHLTH, data$X_RFCHOL)
colnames(freq_data) <- c("Normal\nCholesterol", "High\nCholesterol")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #small
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of high cholesterol (χ2 = 1803, p < 0.01, V = 0.10).
HEART DISEASE OR MYOCARDIAL INFARCTION V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. X_MICHD.
freq_data <- table(data$X_RFHLTH, data$X_MICHD)
colnames(freq_data) <- c("HD/MI History", "No HD/MI\nHistory")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,100000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of heart disease or myocardial infarction (χ2 = 9828, p < 0.01, V = 0.23).
STROKE HISTORY V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. CVDSTRK3.
#People who have had a stroke have higher proportions of Fair or Worse
#health.
freq_data <- table(data$X_RFHLTH, data$CVDSTRK3)
colnames(freq_data) <- c("Stroke History", "No Stroke\nHistory")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,100000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of strokes (χ2 = 4597, p < 0.01, V = 0.16).
ASTHMA V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. X_ASTHMA1.
#People with no asthma have higher proportions of
#good or better health.
freq_data <- table(data$X_RFHLTH, data$X_ASTHMS1)
colnames(freq_data) <- c("Has Asthma", "Doesn't\nHave Asthma")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of asthma (χ2 = 2956, p < 0.01, V = 0.13).
CANCER V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. CNCER.
freq_data <- table(data$X_RFHLTH, data$CNCER)
colnames(freq_data) <- c("Cancer History", "No Cancer\nHistory")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #negligible.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The effect size between cancer status and general health is negligible and will not be considered significant.
COPD, EMPHYSEMA, OR CHRONIC BRONCHITIS V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. CHCCOPD1.
#People with history of lung disease have higher proportions of
#fair or worse general health.
freq_data <- table(data$X_RFHLTH, data$CHCCOPD1)
colnames(freq_data) <- c("Lung Disease History", "No Lung\nDisease History")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of COPD, emphysema, or chronic bronchitis (χ2 = 11962, p < 0.01, V = 0.26).
ARTHRITIS V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. X_DRDXAR1.
#People with arthritis have higher proportions of "Fair or Worse" #health.
freq_data <- table(data$X_RFHLTH, data$X_DRDXAR1)
colnames(freq_data) <- c("Has Arthritis", "No Arthritis")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
# pairwise.prop.test(freq_data) TK
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of arthritis (χ2 = 6706, p < 0.01, V = 0.19).
DEPRESSION V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. ADDEPEV2
#People with no history of depression have higher proportions of
#good or better health.
freq_data <- table(data$X_RFHLTH, data$ADDEPEV2)
colnames(freq_data) <- c("Depression History", "No Depression\nHistory")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history ofdepression (χ2 =6012, p < 0.01, V = 0.18).
KIDNEY DISEASE V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. CHCKIDNY
#People with a history of kidney disease have higher proportions of
#fair or worse health.
freq_data <- table(data$X_RFHLTH, data$CHCKIDNY)
colnames(freq_data) <- c("Kidney Disease History", "No Kidney\nDisease History")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,100000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of kidney disease (χ2 = 4533, p < 0.01, V = 0.16).
DIABETES V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. DIABETE3.
#People with no diabetes have higher proportions of
#good or better health.
freq_data <- table(data$X_RFHLTH, data$DIABETE3)
colnames(freq_data) <- c("Has diabetes", "No Diabetes")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The proportions of fair or worse health were significantly higher for individuals who had a history of diabetes (χ2 =8626, p < 0.01, V = 0.22).
BLINDNESS V. GENERAL HEALTH.
```{r}
#Demographics. Medical Demographics. BLIND.
#Blind individuals have higher proportions of fair or worse health.
freq_data <- table(data$X_RFHLTH, data$BLIND)
colnames(freq_data) <- c("Blind", "Not Blind")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
# pairwise.prop.test(freq_data) TK
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The proportions of fair or worse health were significantly higher for individuals who were blind (χ2 =6166, p < 0.01, V = 0.18).
DAYS IN POOR PHYSICAL HEALTH V. GENERAL HEALTH.
```{r}
#Health and wellness. PHYSHLTH.
wilcox.test(data$X_RFHLTH, data$PHYSHLTH,
paired=FALSE, na.rm = TRUE) # p < 0.01
wilcox_effsize(data, PHYSHLTH ~ X_RFHLTH, na.rm=TRUE) # medium
md <- mean(data$PHYSHLTH[data$X_RFHLTH==1], na.rm = TRUE) - mean(data$PHYSHLTH[data$X_RFHLTH==2], na.rm = TRUE)
print(md)
boxplot(formula=data$PHYSHLTH~data$X_RFHLTH,
ylab="Frequency",
xlab="General Health",
main="Days In Poor Physical Health",
col = c("salmon", "seagreen"),
beside=TRUE,
names=c("Good or Better", "Fair or Worse"))
```
Individuals who reported good or better health spent, on average, significantly fewer days in poor health (MD = -12.42, W = 2.13x1010, p < 0.01). ). The Wilcoxon test of effect size demonstrated a medium effect between physical health and general health (r = 0.48)
DAYS IN POOR MENTAL HEALTH V. GENERAL HEALTH.
```{r}
#Health and wellness. MENTHLTH.
wilcox.test(data$X_RFHLTH, data$MENTHLTH,
paired=FALSE, na.rm = TRUE) # p < 0.01
wilcox_effsize(data, MENTHLTH ~ X_RFHLTH, na.rm=TRUE) # small
mdm <- mean(data$MENTHLTH[data$X_RFHLTH==1], na.rm = TRUE) - mean(data$MENTHLTH[data$X_RFHLTH==2], na.rm = TRUE)
print(mdm)
boxplot(formula=data$MENTHLTH~data$X_RFHLTH,
ylab="Frequency",
xlab="General Health",
main="Days With Poor Mental Health",
col = c("salmon", "seagreen"),
beside=TRUE,
names=c("Good or Better", "Fair or Worse"))
```
Individuals who reported good or better health spent, on average, significantly fewer days in poor mental health (MD = -4.38, W = 2.61x1010, p < 0.01). The Wilcoxon test of effect size demonstrated a small effect between the number of poor mental health days and general health (r = 0.23).
ACTIVITY LIMITATIONS DUE TO HEALTH V. GENERAL HEALTH.
```{r}
#General Health and Wellness. QLACTLM2.
freq_data <- table(data$X_RFHLTH, data$QLACTLM2)
colnames(freq_data) <- c("Activity Limitations", "No Activity\nLimitations")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #medium
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,100000))
```
Individuals who reported activity limitations due to health problems had significantly higher proportions of fair or worse health compared to individuals who had no activity limitations (χ2 = 26102, p < 0.01). Cramer’s V test of effect size demonstrated a medium effect between activity limitations and general health (V = 0.38).
HEALTH PROBLEMS REQUIRING SPECIAL EQUIPMENT V. GENERAL HEALTH.
```{r}
#General health and wellness. USEEQUIP.
#Higher frequency of "Fair or poor" health in people who report
#health problems requiring special equipment.
freq_data <- table(data$X_RFHLTH, data$USEEQUIP)
colnames(freq_data) <- c("Require Special\nEquipment", "No Special\nEquipment")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #medium
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,120000))
```
Individuals who reported that they required special equipment due to health problems also had significantly higher proportions of fair or worse health compared to individuals who did not require special equipment (χ2 = 21628, p < 0.01). Cramer’s V test of effect size demonstrated a medium effect between special equipment and general health (V = 0.34).
COGNITIVE DEFICITS V. GENERAL HEALTH.
```{r}
#General health and wellness. DECIDE.
#Poeple with difficulties concentrating, remembering, or making
#decisions hav higher rates of fair or worse health.
freq_data <- table(data$X_RFHLTH, data$DECIDE)
colnames(freq_data) <- c("Cognitive Deficits", "No Cognitive\nDeficits")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Small.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,120000))
```
Individuals who reported having cognitive deficits (eg, difficulties concentrating, remembering, or making decisions) had significantly higher proportions of fair or worse health compared to individuals who reported no cognitive deficits (χ2 = 11537, p < 0.01). Cramer’s V test of effect size revealed a small effect between cognitive deficits and general health (V = 0.25).
ATTENDING ROUTINE CHECKUPS V. GENERAL HEALTH.
```{r}
#Lifestyle behaviours. Preventative care. CHECKUP1.
freq_data <- table(data$X_RFHLTH, data$CHECKUP1)
colnames(freq_data) <- c("Did Routine Checkup", "Did Not Do\nRoutine Checkup")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #Negligible.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,120000))
```
The effect size between routine checkups and general health is negligible and the results will not be considered significant.
ROUTINE FLU SHOTS V. GENERAL HEALTH.
```{r}
#Lifestyle behaviours. Preventative care. FLUSHOT6.
freq_data <- table(data$X_RFHLTH, data$FLUSHOT6)
colnames(freq_data) <- c("Flu Shot\nPast Year", "No Flu Shot\nPast Year")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p = 0.009
CramerV(freq_data) #Negligible.
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
The effect size between routine flu shots and general health is negligible and the results will not be considered significant.
SMOKING V. GENERAL HEALTH.
```{r}
#Lifestyle behaviours. Drug and Alcohol Consumption. X_SMOKER3.
freq_data <- table(data$X_RFHLTH, data$X_SMOKER3)
colnames(freq_data) <- c("Current", "Former", "Never\nSmoked")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) # small
#Post-hocs.
freq_data_ph <- table(data$X_SMOKER3, data$X_RFHLTH)
rownames(freq_data_ph) <- c("Current", "Former", "Never")
colnames(freq_data_ph)<-c("Good or Better", "Fair or Worse")
pairwiseNominalIndependence(freq_data_ph,
fisher=FALSE,
gtest=FALSE,
chisq=TRUE,
method="fdr")
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,100000))
```
The proportions of good or better and fair or worse health were significantly different across smoking status (χ2 = 2136, p < 0.01). Cramer’s V test of effect size demonstrated a small effect between smoking status and general health (V = 0.10). Adjusted post-hoc tests revealed that non-smokers had significantly higher proportions of good or better health compared to current and former smokers (p < 0.01), and former smokers had significantly higher proportions of good or better health compared to current smokers (p < 0.01).
AVERAGE ALCOHOL CONSUMPTION V. GENERAL HEALTH.
```{r}
#Lifestyle Behaviours. Drug and Alcohol Consumption. AVGDRNK.
#People with good or better health drink more on average.
wilcox.test(data$X_RFHLTH, data$AVGDRNK,
paired=FALSE, na.rm = TRUE) # p < 0.01
wilcox_effsize(data, AVGDRNK ~ X_RFHLTH, na.rm=TRUE) # small
mda <- mean(data$AVGDRNK[data$PHYSHLTH==1], na.rm = TRUE) - mean(data$AVGDRNK[data$PHYSHLTH==2], na.rm = TRUE)
mda
boxplot(formula=data$AVGDRNK~data$X_RFHLTH,
ylab="Frequency",
xlab="General Health",
main="Average Weekly Alchol Consumption",
col = c("salmon", "seagreen"),
beside=TRUE,
names=c("Good or Better", "Fair or Worse"))
```
Individuals who reported good or better health drank, on average, more alcohol than individuals who reported fair or worse health (MD = 0.25, W = 2.40x1010, p < 0.01). The Wilcoxon test of effect size demonstrated a small effect between alcohol consumption and general health (r = 0.19).
DAILY PHYSICAL ACTIVITY V. GENERAL HEALTH.
```{r}
#Lifestyle behaviours. Physical Activity. PA1MIN_
wilcox.test(data$X_RFHLTH, data$PA1MIN_,
paired=FALSE, na.rm = TRUE) # p < 0.01
wilcox_effsize(data, PA1MIN_ ~ X_RFHLTH, na.rm=TRUE) # negligible
boxplot(formula=data$PA1MIN_~data$X_RFHLTH,
ylab="Frequency (Minutes)",
xlab="General Health",
main="Daily Physical Activity",
col = c("salmon", "seagreen"),
beside=TRUE,
names=c("Good or Better", "Fair or Worse"))
```
The effect size between daily physical activity and general health is negligible and the results will not be considered significant.
DAILY VIGOROUS PHYSICAL ACTIVITY V. GENERAL HEALTH
```{r}
#Lifestyle behaviours. Physical Activity. PA1VIGM_.
wilcox.test(data$X_RFHLTH, data$PA1VIGM_,
paired=FALSE, na.rm = TRUE) # p < 0.01
wilcox_effsize(data, PA1VIGM_ ~ X_RFHLTH, na.rm=TRUE) # negligible
boxplot(formula=data$PA1VIGM_~data$X_RFHLTH,
ylab="Frequency (Minutes)",
xlab="General Health",
main="Daily Vigorous Physical Activity",
col = c("salmon", "seagreen"),
beside=TRUE,
names=c("Good or Better", "Fair or Worse"))
```
The effect size between vigorous daily physical activity and general health is negligible and the results will not be considered significant.
MOST COMMON PHYSICAL ACTIVITY V. GENERAL HEALTH.
```{r}
#Lifestyle behaviours. Physical Activity. EXRACT11.
freq_data <- table(data$X_RFHLTH, data$EXRACT11)
# colnames(freq_data) <- c("", "")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #small
freq_data_ph <- table(data$EXRACT11, data$X_RFHLTH, useNA="ifany")
colnames(freq_data_ph)<-c("Good or Better", "Fair or Worse")
pairwiseNominalIndependence(freq_data_ph,
fisher=FALSE,
gtest=FALSE,
chisq=TRUE,
method="fdr")
barplot(freq_data,
ylab="Frequency",
las=2,
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,40000))
```
The proportions of good or better and fair or worse health were significantly different across exercise types (χ2 = 10682, p < 0.01). Cramer’s V test of effect size demonstrated a small effect between exercise types and general health (V = 0.24).
STRENGTH TRAINING V. GENERAL HEALTH.
```{r}
#Lifestyle behaviours. Physical Activity. STRNGTH.
freq_data <- table(data$X_RFHLTH, data$STRNGTH)
colnames(freq_data) <- c("Does Strength\nTraining", "No Strength\nTraining")
rownames(freq_data)<-c("Good or Better", "Fair or Worse")
Xsq <- chisq.test(freq_data)
print(Xsq) # p < 0.01
CramerV(freq_data) #small
barplot(freq_data,
ylab="Frequency",
col = c("salmon", "seagreen"),
beside=TRUE,
legend.text = TRUE,
ylim = c(0,80000))
```
Individuals who reported conducting strength training have significantly higher proportions of good or better health (χ2 = 2336, p < 0.01). Cramer’s V test of effect size demonstrated a small effect between strength training and general health (V = 0.11).
FRUIT CONSUMPTION V. GENERAL HEALTH.
```{r}
#Lifestyle behaviours. Nutrition. X_FRUTSUM.