Cholesterol



Blackboard photo


Classroom task (R script)


First, we repeated the one-sample two-sided T-test, and we learned that the p-value is the type 1 error probability with which the resulting acceptance interval would end precisely at the T statistic. Then we learned that we reject the null hypothesis if the p-value provided by the software is less than the prescribed type 1 error probability (otherwise we accept it). After that, we learned that if the null hypothesis is correct, then the p-value is uniformly distributed on [0,1] (it is a random variable as it is a function of the T statistic). Hence, if we accept the null hypothesis, it doesn't matter whether the p-value is, say, 0.3 or 0.7. On the other hand, if we reject the null hypothesis then the smaller the p-value, the stronger the rejection. See also the above blackboard photo.

After the above theoretical considerations, we imported the second version of the cholesterol data and we tested again (we already tested it in the previous class) the null hypothesis that the expectation of the day14 cholesterol is 260 (as the p-value was high, higher than, say, 0.05, we accepted the null hypothesis).

Then we wrote an own function called tdensity. For each degree of freedom less or equal than the argument, it plots the corresponding Student t-density and the standard normal density on a common figure.

Finally, we imported the first version of the cholesterol data and started to convert it into a similar form to the second version but supplemented with the healthy cholesterols.