To work out exercise 6.5 from Hobson’s book ''

Data shows plasma inorganic phosphate levels (mg/dl) one hour after
a standard glucose tolerance test for obese subjects, with or without hyperinsulinemia, and controls (data from Jones, 1987). (a) Perform a one-factor analysis of variance to test the hypothesis that there are no mean differences among the three groups. What conclusions can you draw?

> folder <- "C:/Cauldron/garage/R/soulcraft/Volatility/Learn/Dobson-GLM/"
> file.input <- paste(folder, "Table 6.18 Plasma phosphate.csv",
+     sep = "")
> data <- read.csv(file.input, header = T, stringsAsFactors = F)
> data$Group <- factor(data$Group)
> boxplot(data$phosphate ~ data$Group)

Chap-6_5-002.jpg

> summary(aov(data$phosphate ~ data$Group))
            Df Sum Sq Mean Sq F value    Pr(>F)
data$Group   2 7.8083  3.9041  11.651 0.0002082 ***
Residuals   28 9.3827  0.3351
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

F stat shows that there is a difference in the means amongst the groups

(b) Obtain a 95 pct confidence interval for the difference in means between
the two obese groups.

> temp <- data[data$Group != "C", ]
> summary(aov(temp$phosphate ~ temp$Group))
            Df Sum Sq Mean Sq F value Pr(>F)
temp$Group   1 1.1950  1.1950  2.6922 0.1192
Residuals   17 7.5460  0.4439
  1. I can use resampling for this..Is there any other way ?
> sig0 <- var(data[data$Group != "C", 2])
> sig1 <- var(data[data$Group == "H-O", 2])
> sig2 <- var(data[data$Group == "N-O", 2])
> mu1 <- mean(data[data$Group == "H-O", 2])
> mu2 <- mean(data[data$Group == "N-O", 2])
> mu1 - mu2 + c(-1, 1) * 2.048 * ((10 * sig1 + 7 * sig2)/17)
[1] -0.4011193  1.4170283

Somehow this answer does not tally with the dobson answer! .T value for 95 conf

> qt(0.975, 28)
[1] 2.048407
> qnorm(0.975)
[1] 1.959964

Since t is little skewed , the 95 pct confidence will have a greater value than 1.95 used in normal dist.

(c) Using an appropriate model examine the standardized residuals for all
the observations to look for any systematic effects and to check the Normality assumption.