University of Sydney

Recap

Analysis of variance (ANOVA)

One-way ANOVA

Bone density

Calcium is an essential mineral that regulates the heart, is important for blood clotting and for building healthy bones. The National Osteoporosis Foundation recommends a daily calcium intake of 1000-1200 mg/day for adult men and women. While calcium is contained in some foods, most adults do not get enough calcium in their diets and take supplements. Unfortunately some of the supplements have side effects such as gastric distress, making them difficult for some patients to take on a regular basis.

A study is designed to test whether there is a difference in mean daily calcium intake in adults with normal bone density, adults with osteopenia (a low bone density which may lead to osteoporosis) and adults with osteoporosis. Adults 60 years of age with normal bone density, osteopenia and osteoporosis are selected at random from hospital records and invited to participate in the study. Each participant’s daily calcium intake is measured based on reported food intake and supplements.




Wayne W. LaMorte, Boston University School of Public Health.

Bone density data

bone1 = read.csv("Bone.csv")
stargazer(bone1, type = "html", summary = FALSE)
Normal Osteopenia Osteoporosis
1 1,200 1,000 890
2 1,000 1,100 650
3 980 700 1,100
4 900 800 900
5 750 500 400
6 800 700 350

Questions


  1. How would you visualise if calcium intakes are different for each disease?

  2. Can you construct a statistic that might provide evidence of these differences?

Data

stargazer(bone1, type = "html", summary = FALSE)
Normal Osteopenia Osteoporosis
1 1,200 1,000 890
2 1,000 1,100 650
3 980 700 1,100
4 900 800 900
5 750 500 400
6 800 700 350

Data

bone = gather(bone1, key = "Disease", value = "Calcium")
stargazer(bone, type = "html", summary = FALSE)
Disease Calcium
1 Normal 1,200
2 Normal 1,000
3 Normal 980
4 Normal 900
5 Normal 750
6 Normal 800
7 Osteopenia 1,000
8 Osteopenia 1,100
9 Osteopenia 700
10 Osteopenia 800
11 Osteopenia 500
12 Osteopenia 700
13 Osteoporosis 890
14 Osteoporosis 650
15 Osteoporosis 1,100
16 Osteoporosis 900
17 Osteoporosis 400
18 Osteoporosis 350

Let’s take a look

boxplot(Calcium ~ Disease, bone)

ANOVA


\[ \begin{eqnarray*} \sum_{i=1}^g\sum_{j=1}^{n_i}(y_{ij}-\bar y_{..})^2&=&\sum_{i=1}^g n_i(y_{i.}-\bar y_{..})^2 \ + \ \sum_{i=1}^g\sum_{j=1}^{n_i}(y_{ij}-\bar y_{i.})^2 \\ \\ \\ SS_{Total} &=& SS_{Treatment} \ + \ SS_{Residual} \end{eqnarray*} \]

Bone density

a1 = aov(Calcium ~ Disease, bone)
print(xtable(a1), type = "html")
Df Sum Sq Mean Sq F value Pr(>F)
Disease 2 152477.78 76238.89 1.39 0.2782
Residuals 15 819833.33 54655.56
summary(a1)
##             Df Sum Sq Mean Sq F value Pr(>F)
## Disease      2 152478   76239   1.395  0.278
## Residuals   15 819833   54656

Assumptions


  • Each sample is from a normal population.

  • All population variances are equal.

  • All samples are independent.

Assumptions

boxplot(Calcium ~ Disease, bone)

car::leveneTest(Calcium ~ Disease, bone)
## 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  1.6311 0.2286
##       15

Assumptions

plot(a1)

## hat values (leverages) are all = 0.1666667
##  and there are no factor predictors; no plot no. 5

Conclusions

a1 = aov(Calcium ~ Disease, bone)
print(xtable(a1), type = "html")
Df Sum Sq Mean Sq F value Pr(>F)
Disease 2 152477.78 76238.89 1.39 0.2782
Residuals 15 819833.33 54655.56


As p-value is large, there is not enough evidence to reject the null hypothesis that there is no relationship between Calcium intake and bone density disorders.

Summary