The following object is masked from 'package:DescTools':
Recode
# ANOVA analysisaov.heartbpchol =aov(Cholesterol ~ BP_Status, data = heartbpchol)summary(aov.heartbpchol)
Df Sum Sq Mean Sq F value Pr(>F)
BP_Status 2 25211 12605 6.671 0.00137 **
Residuals 538 1016631 1890
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Convert BP_Status to factorheartbpchol$BP_Status =as.factor(heartbpchol$BP_Status)# ANOVA using linear modelanova(lm(Cholesterol ~ BP_Status, data = heartbpchol))
Analysis of Variance Table
Response: Cholesterol
Df Sum Sq Mean Sq F value Pr(>F)
BP_Status 2 25211 12605.4 6.6708 0.001375 **
Residuals 538 1016631 1889.6
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(aov.heartbpchol)
Df Sum Sq Mean Sq F value Pr(>F)
BP_Status 2 25211 12605 6.671 0.00137 **
Residuals 538 1016631 1890
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Table of BP_Statustable(heartbpchol$BP_Status)
High Normal Optimal
229 245 67
# Levene's Test for homogeneity of varianceLeveneTest(aov.heartbpchol)
Warning in LeveneTest.default(y = y, group = group, ...): group coerced to
factor.
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 2 0.1825 0.8332
538
# Linear regression modellm.res_heartbpchol =lm(Cholesterol ~ BP_Status, data = heartbpchol)anova(lm.res_heartbpchol)
Analysis of Variance Table
Response: Cholesterol
Df Sum Sq Mean Sq F value Pr(>F)
BP_Status 2 25211 12605.4 6.6708 0.001375 **
Residuals 538 1016631 1889.6
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1