This question comes from Ramsey and Schafer Statistical Sleuth, Second Edition, Chapter 7:
Immediately after slaughter the pH in postmortem muscle of a steer carcass is around 7.0-7.2. For a certain kind of meat processing to take place it is necessary for pH to decrease to 6.0 so an estimate is needed of the time after slaughter at which the pH reaches 6.0. To do so, ten steer carcasses were identified to have their immediate slaughter postmortem pH level taken, and then at one of 5 times after slaughter. Time is measured in hours. There are 10 obsevations.
I am trying to do the following in R:
Test whether the log of time after slaughter is a statistically significant predictor of postmoterm pH levels.
Report the estimated mean pH at 5 hours and its confidence interval.
Report the predicted pH at 5 hours and its prediction interval.
How long after slaughter would you expect the mean pH level to be 6.0?
My data is as follows:
TIME PH
1 1 7.02
2 1 6.93
3 2 6.42
4 2 6.51
5 4 6.07
6 4 5.99
7 6 5.59
8 6 5.80
9 8 5.51
10 8 5.36
For 1, my code is
mod2<-lm(PH~log(TIME), data=meat)
summary(mod2)
log(TIME)
has a p-value of 2.70e-08, which is statistically significant at a 5% confidence level.
However, I am confused as to how to calculate 2, 3, and 4.
For 2 and 3, I'm specifically not totally clear on the difference between what is being asked. I calculated the following:
y <- predict(mod2,newdata=data.frame(TIME=c(5)))
which, if I am not mistaken, is the predicted pH at 5 hours, right?
The prediction and confidence intervals can be calculated by some variation of the following, if I am not mistaken:
predict(..., interval = "confidence")
predict(..., interval = "prediction")
But what is the difference between, and how would one calculate, the estimated vs predicted pH at 5 hours (and their associated intervals)?
As for 4., I'm just totally unsure of how to calculate it.
I would greatly appreciate it if people could please take the time to clarify my misunderstandings and demonstrate how to calculate them using R.