The dataset is data from the 2021 National Health Interview Adult Survey. The survey contained questions related to household and family composition, demographics about the survey taker, satisfaction with life, health insurance, medication, immunization, preventive screenings, and multiple health problems such as hypertension, cardiovascular conditions, cancer, vision, hearing, mobility, and more.
This survey is important in following the health of American’s based on many different factors of their lives. Looking at previous surveys can also help to see trends in Americans’ health.
1. Does education level play a role in the mental or physical health?
2. What are some health issues that correlate to other health issues?
3: What health issues are more common among certain demographics?
4: Has COVID possibly had an effect on certain health issues?
5: Is there a link between physical health and mental health?
1: Excellent
2: Very Good
3: Good
4: Fair
5: Poor
7: Refused
8: Not Ascertained
9: Don't Know
1: Very Satisfied
2: Satisfied
3: Dissatisfied
4: Very Dissatisfied
7: Refused
8: Not Ascertained
9: Don't Know
Classification of County Lived In
1: Large central metro
2: Large fringe metro
3: Medium and small metro
4: Nonmetropolitan
Household Region
1: Northeast
2: Midwest
3: South
4: West
Age
18-84: 18-84 with number corresponding
85: 85+
97: Refused
98: Not Ascertained
99: Don't Know
Age 65+
1: Less than 65
2: 65 or older
7: Refused
8: Not Ascertained
9: Don't Know
Sex
1: Male
2: Female
7: Refused
8: Not Ascertained
9: Don't Know
0: Never attended/Kindergarten only
1: Grade 1-11
2: 12th grade, no diploma
3: GED or equivalent
4: High School Graduate
5: Some college, no degree
6: Associate degree: occupational, technical, or vocational program
7: Associate degree: academic program
8: Bachelor's degree
9: Master's degree
10: Professional School or Doctoral degree
97: Refused
98: Not Ascertained
99: Don't Know
Person's weight in lbs
Person's height in ???
Questions were laid out as...
Told you have (condition)?
Told you have (condition) on 2 or more visits?
Had (condition) in past 12 months?
...with the possible responses being,
1: Yes. 1 answered if respondant is taking medication to control the issue
2: No
7: Refused
8: Not Ascertained
9: Don't Know
Types Included
1.
2
3
4
Age when first told had (type) cancer?
1-84: 1-84 years, with the corresponding number
85: 85+ years
97: Refused
98: Not Ascertained
99: Don't Know
Days Missed Work
0-129: 0 to 129 with corresponding value
130: 130+ days
997: Refused
998: Not Ascertained
999: Don't Know"
Most of the column names were unclear until I read the Codebook, however it was often easy to tell what category something fell under such as EDUCP_A, likely had something to do with education, while variable with CAN in them had to do with Cancer. I have an Excel sheet of the data where I have the columns color coded by if I know them from the codebook, if they are not in the codebook, or if I will not be using that column. Some of these unclear ones are the ones that start with DRK, PA18, MOD, VIG, and STR. I am still working on figuring those out.
Among the columns I do know, there are a few that I am unclear about. Among the cancer ones, they are asked what age were they told they have colon-rectal cancer. However, two other questions ask about colon cancer and rectal cancer, so I am trying to figure out if those are the same things, or separated.
dfColonRectal <- adult22[ , c("COLRCAGETC_A", "COLONAGETC_A", "RECTUAGETC_A")]
dfColonRectalAge <-subset(dfColonRectal, COLRCAGETC_A<="85")
#count(dfColonRectalAge) = 196
#print(dfColonRectalAge)
dfColonRectalAgeTest <-subset(dfColonRectalAge, COLRCAGETC_A==COLONAGETC_A | COLRCAGETC_A==RECTUAGETC_A)
#count(dfColonRectalAgeTest) = 196
Both have 196, so that means they have the same age that they put for ColoRectal in either Colon or Rectal. So this won’t cause problems for the data, I just have to make sure I don’t include ColoRectal and Colon, or ColoRectal and Rectal as separate cancers. Such as if I am counting how many types of cancer one person has.
dfWeightFilter <- adult22 %>%
filter(WEIGHTLBTC_A <= 996)
paste("Mean:",mean(dfWeightFilter$WEIGHTLBTC_A))
## [1] "Mean: 230.906970736928"
paste("Max:",max(dfWeightFilter$WEIGHTLBTC_A))
## [1] "Max: 996"
paste("Min:",min(dfWeightFilter$WEIGHTLBTC_A))
## [1] "Min: 100"
# Age
dfAgeFilter <- adult22 %>%
filter(AGEP_A < 97)
paste("Mean:",mean(dfAgeFilter$AGEP_A))
## [1] "Mean: 52.9485989777794"
paste("Max:",max(dfAgeFilter$AGEP_A))
## [1] "Max: 85"
paste("Min:",min(dfAgeFilter$AGEP_A))
## [1] "Min: 18"
paste("Over 85:",nrow(dfAgeFilter[dfAgeFilter$AGEP_A == '85', ]))
## [1] "Over 85: 1002"
paste("Under 85:",nrow(dfAgeFilter[dfAgeFilter$AGEP_A < '85', ]))
## [1] "Under 85: 26585"
dfSexFilter <- adult22 %>%
filter(SEX_A < 7)
dfSexFilter <-
dfSexFilter |>
group_by(dfSexFilter$SEX_A) |>
mutate(Sex_Status = ifelse(SEX_A == 1,
"Male",
"Female")) |>
ungroup()
ggplot(dfSexFilter, aes(x = Sex_Status)) +
geom_bar()
dfEduFilter <- adult22 %>%
filter(EDUCP_A < 97)
dfEduFilter <-
dfEduFilter |>
group_by(dfEduFilter$EDUCP_A) |>
mutate(Edu_Status = ifelse(EDUCP_A == 1,
"Grade 1-11",
ifelse(EDUCP_A == 2,
"12th Grade, no Diploma",
ifelse(EDUCP_A == 3,
"GED or Equivalent",
ifelse(EDUCP_A == 4,
"High School Graduate",
ifelse(EDUCP_A == 5,
"Some College, no Degree",
ifelse(EDUCP_A == 6,
"Associate degree: occupational, technical, or vocational program",
ifelse(EDUCP_A == 7,
"Associate degree: academic program",
ifelse(EDUCP_A == 8,
"Bachelor's degree",
ifelse(EDUCP_A == 9,
"Master's degree ",
ifelse(EDUCP_A == 10,
"Professional School or Doctoral degree",
ifelse(EDUCP_A == 97,
"Refused",
"Don't Know")))))))))))) |>
ungroup()
dfEduFilter$Edu_Status <- factor(dfEduFilter$Edu_Status, levels = c("Grade 1-11", "12th Grade, no Diploma", "GED or Equivalent","High School Graduate", "Some College, no Degree", "Associate degree: occupational, technical, or vocational program", "Associate degree: academic program", "Bachelor's degree", "Master's degree ", "Professional School or Doctoral degree", "Refused", "Don't Know"))
ggplot(dfEduFilter, aes(x = EDUCP_A, fill=Edu_Status)) +
geom_bar() + theme(axis.title.x=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank())
#General Health
dfGHFilter <- adult22 %>%
filter(PHSTAT_A < '7')
dfGHFilter <- dfGHFilter %>%
filter(AGEP_A < '97')
mean(dfGHFilter$PHSTAT_A)
## [1] 2.439941
ggplot(dfGHFilter, aes(x = PHSTAT_A)) +
geom_bar()
plot(dfGHFilter$AGEP_A , dfGHFilter$PHSTAT_A)
abline(lm(dfGHFilter$PHSTAT_A ~ dfGHFilter$AGEP_A), col = "red", lwd = 3)
#Weight and Health
# dfWeightFilter <- adult22[adult22$WEIGHTLBTC_A < '997', ]
plot(dfWeightFilter$WEIGHTLBTC_A)
dfWHFilter <- dfWeightFilter %>%
filter(PHSTAT_A <= 6)
dfHighHealth <- dfWHFilter %>%
filter(PHSTAT_A < 3 )
dfHighWeight <- dfWHFilter %>%
filter(WEIGHTLBTC_A >= 250 )
Weight1 <- nrow(dfWeightFilter[dfWeightFilter$WEIGHTLBTC_A < '150', ])
Weight2 <- nrow(dfWeightFilter[dfWeightFilter$WEIGHTLBTC_A > '150' & dfWeightFilter$WEIGHTLBTC_A <= '200', ])
Weight3 <- nrow(dfWeightFilter[dfWeightFilter$WEIGHTLBTC_A > '200' & dfWeightFilter$WEIGHTLBTC_A <= '250', ])
Weight4 <- nrow(dfWeightFilter[dfWeightFilter$WEIGHTLBTC_A <= '250', ])
dfWeightCount <- data.frame(Weight1, Weight2, Weight3, Weight4)
print(dfWeightCount)
## Weight1 Weight2 Weight3 Weight4
## 1 6451 11717 5008 24210
plot(dfWHFilter$WEIGHTLBTC_A, dfWHFilter$PHSTAT_A, xlab = "Weight", ylab = "General Health")
plot(dfHighWeight$WEIGHTLBTC_A, dfHighWeight$PHSTAT_A, xlab = "Weight", ylab = "General Health")
hist(dfWeightFilter$WEIGHTLBTC_A, )
#Weight and Height
plot(adult22$WEIGHTLBTC_A, adult22$HEIGHTTC_A)
# Group_By
dfEdu <- adult22 %>% group_by(adult22$EDUCP_A)
mean(dfEdu$EDUCP_A)
## [1] 6.443528
# which is an associate degree
# Probability of at least an associate degree (6, 7, 8, 9, 10)
prob_Associate_Up<- nrow(dfEdu[dfEdu$EDUCP_A >= '6' & dfEdu$EDUCP_A <= '10', ])
prob_All <- nrow(dfEdu)
prob_Associate_Up/prob_All
## [1] 0
# Probability of below grade 12
prob_Under_12 <- nrow(dfEdu[dfEdu$EDUCP_A <= '1', ])
prob_Under_12/prob_All
## [1] 0.06802647
# Probability of associate or higher and positive life satisfaction
prob_Associate_Satisfied <- nrow(dfEdu[dfEdu$EDUCP_A >= '6' & dfEdu$EDUCP_A <= '10' & dfEdu$LSATIS4_A <= '2', ])
prob_Associate_Satisfied/prob_Associate_Up
## [1] NaN
#Probability of below grade 12 and satisfied
prob_Under12_Satisfied <- nrow(dfEdu[dfEdu$EDUCP_A <= '1' & dfEdu$LSATIS4_A <= '2', ])
prob_Under12_Satisfied/prob_Under_12
## [1] 0.917597
plot
## function (x, y, ...)
## UseMethod("plot")
## <bytecode: 0x7fe080521248>
## <environment: namespace:base>
#Probability of normal BMI(18.5 to 24.9) and general health
dfHealth <- adult22 %>% group_by(adult22$PHSTAT_A)
prob_NormBMI <- nrow(dfHealth[dfHealth$BMICAT_A == '2', ])
prob_NormBMI/prob_All
## [1] 0.307186
prob_NormBMI_GoodHealth <- nrow(dfHealth[dfHealth$BMICAT_A == '2' & dfHealth$PHSTAT_A <= '4', ])
prob_NormBMI_GoodHealth/prob_NormBMI
## [1] 0.970332
#Probability of overweight BMI and positive/negative health
prob_OverweightBMI <- nrow(dfHealth[dfHealth$BMICAT_A == '3', ])
prob_OverweightBMI/prob_All
## [1] 0.3357926
prob_OverweightBMI_GoodHealth <- nrow(dfHealth[dfHealth$BMICAT_A == '3' & dfHealth$PHSTAT_A <= '4', ])
prob_OverweightBMI_GoodHealth/prob_OverweightBMI
## [1] 0.9696284
prob_OverweightBMI_BadHealth <- nrow(dfHealth[dfHealth$BMICAT_A == '3' & dfHealth$PHSTAT_A == '5', ])
prob_OverweightBMI_BadHealth/prob_OverweightBMI
## [1] 0.02994076
prob_GoodHealth <- nrow(dfHealth[dfHealth$PHSTAT_A <= '4', ])
# How many of all BMIs considered themselves to be in good health
prob_GoodHealth/prob_All
## [1] 0.9626053
# About 96% of people considered themselves to be in good, or greater health. Even among different BMIs, the percent that considered themselves to be in good health was above 90%.
# Why do most people see themselves to be in good health, or were most of the survey takers healthy in general? -- Check the more specific medical issues
# Sort BMI by Underweight, Normal, Overweight, Obese
adult22_raw <- adult22
adult22BMI <- adult22_raw
adult22BMI <-
adult22BMI |>
group_by(adult22BMI$BMICAT_A) |>
mutate(BMI_Status = ifelse(BMICAT_A == 1,
"Under",
ifelse(BMICAT_A == 3,
"Over",
ifelse(BMICAT_A == 4,
"Obese",
ifelse(BMICAT_A,
"Normal",
"Unknown"))))) |>
ungroup()
Normal <- nrow(adult22BMI[adult22BMI$BMI_Status == 'Normal',])
# Life Satisfaction and General Health
prob_GoodLS_Health <- nrow(dfHealth[dfHealth$LSATIS4_A <= '2' & dfHealth$PHSTAT_A <= '4', ])
prob_GoodLS_Health/prob_All
## [1] 0.9275976
#Prob out of those who have high general health
prob_GoodLS_Health/prob_GoodHealth
## [1] 0.9636323
#Bad life satisfaction and bad health out of all
prob_BadLS_Health <- nrow(dfHealth[dfHealth$LSATIS4_A >= '3' & dfHealth$LSATIS4_A <=4 & dfHealth$PHSTAT_A == '5', ])
prob_BadLS_Health/prob_All
## [1] 0.01182597
#Bad life satisfaction among those with low health
prob_Low_LS <- nrow(dfHealth[dfHealth$PHSTAT_A == '5',])
prob_BadLS_Health/prob_Low_LS
## [1] 0.3180934
plot(adult22$EDUCP_A , adult22$LSATIS4_A)
abline(lm(adult22$LSATIS4_A ~ adult22$EDUCP_A), col = "red", lwd = 3)
dfEduSample <- dfEdu[ , c("EDUCP_A")]
dfEdu1 <- sample_n(dfEduSample,100, replace = TRUE)
dfEdu2 <- sample_n(dfEduSample,100, replace = TRUE)
dfEdu3 <- sample_n(dfEduSample,100, replace = TRUE)
dfEdu4 <- sample_n(dfEduSample,100, replace = TRUE)
dfEdu5 <- sample_n(dfEduSample,100, replace = TRUE)
print(dfEdu1)
## # A tibble: 100 × 1
## EDUCP_A
## <int>
## 1 4
## 2 5
## 3 7
## 4 9
## 5 1
## 6 1
## 7 5
## 8 4
## 9 5
## 10 8
## # ℹ 90 more rows
paste("Sample 1 Mean:", mean(dfEdu1$EDUCP_A))
## [1] "Sample 1 Mean: 5.94"
print(dfEdu2)
## # A tibble: 100 × 1
## EDUCP_A
## <int>
## 1 9
## 2 8
## 3 4
## 4 8
## 5 1
## 6 1
## 7 8
## 8 5
## 9 1
## 10 2
## # ℹ 90 more rows
paste("Sample 2 Mean:", mean(dfEdu2$EDUCP_A))
## [1] "Sample 2 Mean: 6.82"
print(dfEdu3)
## # A tibble: 100 × 1
## EDUCP_A
## <int>
## 1 8
## 2 5
## 3 5
## 4 8
## 5 8
## 6 4
## 7 3
## 8 8
## 9 1
## 10 4
## # ℹ 90 more rows
paste("Sample 3 Mean:", mean(dfEdu3$EDUCP_A))
## [1] "Sample 3 Mean: 5.96"
print(dfEdu4)
## # A tibble: 100 × 1
## EDUCP_A
## <int>
## 1 4
## 2 1
## 3 4
## 4 7
## 5 4
## 6 8
## 7 8
## 8 9
## 9 4
## 10 1
## # ℹ 90 more rows
paste("Sample 4 Mean:", mean(dfEdu4$EDUCP_A))
## [1] "Sample 4 Mean: 6.73"
print(dfEdu5)
## # A tibble: 100 × 1
## EDUCP_A
## <int>
## 1 4
## 2 8
## 3 4
## 4 5
## 5 8
## 6 4
## 7 1
## 8 9
## 9 4
## 10 8
## # ℹ 90 more rows
paste("Sample 5 Mean:", mean(dfEdu5$EDUCP_A))
## [1] "Sample 5 Mean: 6.02"
# The average tends to be between 5 (some college) and 8 (Bachelor's degree), among all the samples. However if any sample ends up with the 97,98, or 99 that correspond with "don't know", then the sample will be greatly skewed.
dfWeightHeightSample <- dfHealth[ , c("WEIGHTLBTC_A", "HEIGHTTC_A")]
dfWH1 <- sample_n(dfWeightHeightSample,100, replace = TRUE)
dfWH2 <- sample_n(dfWeightHeightSample,100, replace = TRUE)
dfWH3 <- sample_n(dfWeightHeightSample,100, replace = TRUE)
dfWH4 <- sample_n(dfWeightHeightSample,100, replace = TRUE)
dfWH5 <- sample_n(dfWeightHeightSample,100, replace = TRUE)
print(dfWH1)
## # A tibble: 100 × 2
## WEIGHTLBTC_A HEIGHTTC_A
## <int> <int>
## 1 195 63
## 2 130 62
## 3 138 66
## 4 190 74
## 5 170 60
## 6 215 69
## 7 120 65
## 8 180 67
## 9 999 62
## 10 118 63
## # ℹ 90 more rows
print(dfWH2)
## # A tibble: 100 × 2
## WEIGHTLBTC_A HEIGHTTC_A
## <int> <int>
## 1 145 65
## 2 110 61
## 3 200 67
## 4 165 70
## 5 200 66
## 6 268 67
## 7 160 70
## 8 170 64
## 9 147 67
## 10 193 70
## # ℹ 90 more rows
print(dfWH3)
## # A tibble: 100 × 2
## WEIGHTLBTC_A HEIGHTTC_A
## <int> <int>
## 1 225 71
## 2 170 69
## 3 150 65
## 4 160 62
## 5 145 64
## 6 997 61
## 7 198 63
## 8 150 60
## 9 144 64
## 10 160 63
## # ℹ 90 more rows
print(dfWH4)
## # A tibble: 100 × 2
## WEIGHTLBTC_A HEIGHTTC_A
## <int> <int>
## 1 236 66
## 2 240 67
## 3 265 72
## 4 180 67
## 5 165 67
## 6 168 72
## 7 175 67
## 8 178 67
## 9 130 64
## 10 996 96
## # ℹ 90 more rows
print(dfWH5)
## # A tibble: 100 × 2
## WEIGHTLBTC_A HEIGHTTC_A
## <int> <int>
## 1 135 62
## 2 165 63
## 3 180 72
## 4 190 67
## 5 996 96
## 6 182 71
## 7 162 71
## 8 245 74
## 9 996 96
## 10 230 72
## # ℹ 90 more rows
plot(dfWH1$WEIGHTLBTC_A,dfWH1$HEIGHTTC_A,type="p",main="Normal Distribution",xlab="Weight(lbs)",ylab="Height")
points(dfWH2$WEIGHTLBTC_A,dfWH2$HEIGHTTC_A, col="green")
points(dfWH3$WEIGHTLBTC_A,dfWH3$HEIGHTTC_A,col="blue")
points(dfWH4$WEIGHTLBTC_A,dfWH4$HEIGHTTC_A,col="red")
points(dfWH5$WEIGHTLBTC_A,dfWH5$HEIGHTTC_A,col="yellow")
abline(lm(dfWeightHeightSample$HEIGHTTC_A ~ dfWeightHeightSample$WEIGHTLBTC_A), col = "red", lwd = 3)
dfGenHealthSample <- dfHealth[ , c("PHSTAT_A")]
dfGH1 <- sample_n(dfGenHealthSample,100, replace = TRUE)
dfGH2 <- sample_n(dfGenHealthSample,100, replace = TRUE)
dfGH3 <- sample_n(dfGenHealthSample,100, replace = TRUE)
dfGH4 <- sample_n(dfGenHealthSample,100, replace = TRUE)
dfGH5 <- sample_n(dfGenHealthSample,100, replace = TRUE)
# Average
print(mean(dfGH1$PHSTAT_A))
## [1] 2.36
print(mean(dfGH2$PHSTAT_A))
## [1] 2.31
print(mean(dfGH3$PHSTAT_A))
## [1] 2.36
print(mean(dfGH4$PHSTAT_A))
## [1] 2.38
print(mean(dfGH5$PHSTAT_A))
## [1] 2.54
# The average tends to be between 2 and 3, which makes sense because the general health among all survey takers is often a 2 (Very good) or 3 (Good).
Types:
BLADDCAN_A BLOODCAN_A BONECAN_A BRAINCAN_A BREASCAN_A CERVICAN_A ESOPHCAN_A GALLBCAN_A LARYNCAN_A LEUKECAN_A LIVERCAN_A LUNGCAN_A LYMPHCAN_A MELANCAN_A MOUTHCAN_A OVARYCAN_A PANCRCAN_A PROSTCAN_A SKNMCAN_A SKNNMCAN_A SKNDKCAN_A STOMACAN_A THROACAN_A THYROCAN_A UTERUCAN_A HDNCKCAN_A COLRCCAN_A OTHERCANP_A
Number of reported cancers: NUMCAN_A
Age Told has Cancer
BLADDAGETC_A BLOODAGETC_A BONEAGETC_A BRAINAGETC_A BREASAGETC_A CERVIAGETC_A COLONAGETC_A ESOPHAGETC_A GALLBAGETC_A LARYNAGETC_A LEUKEAGETC_A LIVERAGETC_A LUNGAGETC_A LYMPHAGETC_A MELANAGETC_A MOUTHAGETC_A OVARYAGETC_A PANCRAGETC_A PROSTAGETC_A SKNMAGETC_A SKNNMAGETC_A SKNDKAGETC_A STOMAAGETC_A THROAAGETC_A THYROAGETC_A UTERUAGETC_A HDNCKAGETC_A COLRCAGETC_A OTHERAGETC_A
# Cancers df
dfCancer <- adult22 %>%
filter(NUMCAN_A > 0 & NUMCAN_A < 7)
ggplot(dfCancer, aes(x = NUMCAN_A)) +
geom_bar()
ggplot(dfCancer, aes(NUMCAN_A, LSATIS4_A, colour=NUMCAN_A)) +
geom_line() +
geom_point()
ggplot(dfCancer, aes(NUMCAN_A, AGEP_A, colour=NUMCAN_A)) +
geom_line() +
geom_point()
plot(dfCancer$AGEP_A, dfCancer$NUMCAN_A)
abline(lm(dfCancer$NUMCAN_A ~ dfCancer$AGEP_A), col = "red", lwd = 3)
# Age CI of those with cancer
resultCAN <- t.test(dfCancer$AGEP_A)
confidence_intervalCAN <- resultCAN$conf.int
confidence_intervalCAN
## [1] 68.11267 68.97246
## attr(,"conf.level")
## [1] 0.95
mean(dfCancer$AGEP_A)
## [1] 68.54257
# Age CI of those without cancer
dfNoCancer <- adult22 %>%
filter(NUMCAN_A == 0)
# Age CI of those with no cancer
resultNOCAN <- t.test(dfNoCancer$AGEP_A)
confidence_intervalNONE <- resultNOCAN$conf.int
confidence_intervalNONE
## [1] 50.60551 51.06352
## attr(,"conf.level")
## [1] 0.95
mean(dfNoCancer$AGEP_A)
## [1] 50.83452
# Age CI of all
result <- t.test(adult22$AGEP_A)
confidence_interval <- result$conf.int
confidence_interval
## [1] 52.83239 53.26945
## attr(,"conf.level")
## [1] 0.95
mean(adult22$AGEP_A)
## [1] 53.05092
cohen.d(adult22$BMICAT_A, adult22$LSATIS4_A)
##
## Cohen's d
##
## d estimate: 1.500028 (large)
## 95 percent confidence interval:
## lower upper
## 1.481159 1.518896
# Effect size is 1.500028
sd(adult22$BMICAT_A)
## [1] 1.220661
sd(adult22$LSATIS4_A)
## [1] 0.6952925
#got error of out of workspace until I added the simulate.p.value. In then was taking a very long time to run the cell.
# fisher.test(select(adult22, BMICAT_A, LSATIS4_A), simulate.p.value = TRUE)
cohen.d(adult22$BMICAT_A, adult22$PHSTAT_A)
##
## Cohen's d
##
## d estimate: 0.5916467 (medium)
## 95 percent confidence interval:
## lower upper
## 0.5746166 0.6086768
#Effect size is 0.5916467
sd(adult22$BMICAT_A)
## [1] 1.220661
sd(adult22$PHSTAT_A)
## [1] 1.058337
dfUnderBMI <- adult22 %>%
filter(BMICAT_A == 1 )
dfUnderBMI <- dfUnderBMI %>%
filter(LSATIS4_A < 7 )
dfNormalBMI <- adult22 %>%
filter(BMICAT_A == 2 )
dfNormalBMI <- dfNormalBMI %>%
filter(LSATIS4_A < 7 )
dfOverBMI <- adult22 %>%
filter(BMICAT_A == 3 )
dfOverBMI <- dfOverBMI %>%
filter(LSATIS4_A < 7 )
dfObeseBMI <- adult22 %>%
filter(BMICAT_A == 4 )
dfObeseBMI <- dfObeseBMI %>%
filter(LSATIS4_A < 7 )
mean(dfUnderBMI$LSATIS4_A)
## [1] 1.6875
mean(dfNormalBMI$LSATIS4_A)
## [1] 1.570281
mean(dfOverBMI$LSATIS4_A)
## [1] 1.576346
mean(dfObeseBMI$LSATIS4_A)
## [1] 1.670496
Status = c("Underweight", "Normal BMI", "Overweight", "Obese")
LifeSatisfaction = c(mean(dfUnderBMI$LSATIS4_A), mean(dfNormalBMI$LSATIS4_A), mean(dfOverBMI$LSATIS4_A), mean(dfObeseBMI$LSATIS4_A))
dfPlot <- data.frame(Status, LifeSatisfaction)
ggplot(dfPlot, aes(x=Status, LifeSatisfaction)) + geom_point(fill='black')
dfUnderBMI <- adult22 %>%
filter(BMICAT_A == 1 )
dfUnderBMI <- dfUnderBMI %>%
filter(PHSTAT_A < 7 )
dfNormalBMI <- adult22 %>%
filter(BMICAT_A == 2 )
dfNormalBMI <- dfNormalBMI %>%
filter(PHSTAT_A < 7 )
dfOverBMI <- adult22 %>%
filter(BMICAT_A == 3 )
dfOverBMI <- dfOverBMI %>%
filter(PHSTAT_A < 7 )
dfObeseBMI <- adult22 %>%
filter(BMICAT_A == 4 )
dfObeseBMI <- dfObeseBMI %>%
filter(PHSTAT_A < 7 )
mean(dfUnderBMI$PHSTAT_A)
## [1] 2.516204
mean(dfNormalBMI$PHSTAT_A)
## [1] 2.176284
mean(dfOverBMI$PHSTAT_A)
## [1] 2.360845
mean(dfObeseBMI$PHSTAT_A)
## [1] 2.759814
Status = c("Underweight", "Normal BMI", "Overweight", "Obese")
PhysicalHealth = c(mean(dfUnderBMI$PHSTAT_A), mean(dfNormalBMI$PHSTAT_A), mean(dfOverBMI$PHSTAT_A), mean(dfObeseBMI$PHSTAT_A))
dfPlot <- data.frame(Status, PhysicalHealth)
ggplot(dfPlot, aes(x=Status, PhysicalHealth)) + geom_point(fill='black')