Calculating P-values in R
Notes below are documented for future reference should I ever need to use them again someday. A pharmaceutical company is interested in testing a potential blood pressure lowering medication. Their first examination considers only subjects that received the medication at baseline then two weeks later. The data are as follows (SBP in mmHg) Subject Baseline Week 2 1 140 132 2 138 135 3 150 151 4 148 146 5 135 130 Consider testing the hypothesis that there was a mean reduction in blood pressure? Give the P-value for the associated two sided T test. (Hint, consider that the observations are paired). Solution: baseline c ( 140 , 138 , 150 , 148 , 135 ) week2 c ( 132 , 135 , 151 , 146 , 130 ) round ( t.test ( baseline , week2 , paired = TRUE ) $ p.value , 3 ) ## [1] 0.087 Researchers conducted a blind taste test of Coke versus Pepsi. Each of four people was asked which of two blinded drinks given in random order that they preferred. The data was such that 3 of the...