In: Statistics and Probability
We wish to test if SBP
changed after treatment for subjects in the treatment arm. Test
H
0
:
μ
t
=
μ
c
versus
H
a
:
μ
t
6
=
μ
c
for patients in the treatment arm using R
function
t.test
.
44. What is the mean change in SBP (pre - post) in the treatment
group?
– a)
-4.230
– b)
2.212
– c)
0.543
– d)
-0.654
45. What is the 95% confidence interval for the mean change?
– a)
(-3.2543, 4.2543)
– b)
(-7.5445, -1.4325)
– c)
(2.5436, 9.3654)
– d)
(1.4329, 2.9911)
46. What is the
t
statistic for the test?
– a)
-2.5436
– b)
2.5436
9
– c)
5.8595
– d)
-0.4365
47. What are the degrees of freedom of the test statistic?
– a)
48
– b)
50
– c)
24
– d)
25
48. What is the
p
value for the test?
– a)
0.3825
– b)
≈
0
– c)
0.0133
– d)
0.9483
sex | arm | sbp.pre | dbp.pre | sbp.post | dbp.post | |
m | t | 123.1 | 84.2 | 120.2 | 82.3 | |
m | t | 115.4 | 93.1 | 114.2 | 92.1 | |
m | t | 110.2 | 86.8 | 109.2 | 96.6 | |
m | t | 118.4 | 93.2 | 117.7 | 98 | |
m | t | 119.3 | 91 | 114.1 | 94.6 | |
m | t | 119 | 91.4 | 118.8 | 83.2 | |
m | t | 116.9 | 80 | 116.1 | 70.5 | |
m | t | 122.3 | 87.3 | 117.9 | 87.4 | |
m | t | 125.1 | 99.6 | 120.9 | 99.9 | |
m | t | 124.2 | 83 | 121.1 | 87.6 | |
m | t | 120.8 | 90.3 | 117.4 | 99.9 | |
m | t | 121 | 87.5 | 124.2 | 82.4 | |
m | t | 112.8 | 88.7 | 109.8 | 90.3 | |
m | t | 117.8 | 93.1 | 115.9 | 95.9 | |
m | t | 112.2 | 82.3 | 112.1 | 80.7 | |
m | c | 125 | 86.3 | 125.4 | 82.6 | |
m | c | 124.3 | 92.3 | 125.5 | 86.8 | |
m | c | 123.5 | 89 | 123.6 | 84.4 | |
m | c | 128 | 97.4 | 130 | 94.3 | |
m | c | 125.7 | 97.6 | 126.6 | 91 | |
m | c | 122.8 | 96 | 124.3 | 92.4 | |
m | c | 117 | 85.3 | 115.4 | 88.1 | |
m | c | 128 | 87 | 126.6 | 87.6 | |
m | c | 119.3 | 83.1 | 116 | 82.4 | |
m | c | 123.3 | 100 | 123.9 | 97.5 | |
m | c | 124.5 | 90.7 | 124.2 | 98.3 | |
m | c | 120.7 | 94.5 | 123.8 | 103.3 | |
f | t | 112 | 81.9 | 111.1 | 85.5 | |
f | t | 122.2 | 89.8 | 121.6 | 89.3 | |
f | t | 119.5 | 90.3 | 115.2 | 91.3 | |
f | t | 108.7 | 90 | 105.8 | 100.7 | |
f | t | 121.9 | 97.9 | 118.3 | 101.3 | |
f | t | 118 | 80.1 | 117.4 | 75.5 | |
f | t | 120.4 | 88.4 | 117.1 | 92.3 | |
f | t | 115.7 | 92.1 | 111.6 | 93.2 | |
f | t | 117 | 97.8 | 114.1 | 96.1 | |
f | t | 119.1 | 94 | 115.9 | 88.4 | |
f | c | 106.1 | 90.6 | 107.5 | 87 | |
f | c | 109.6 | 83.5 | 107.2 | 85.2 | |
f | c | 111.9 | 88.6 | 108 | 90.7 | |
f | c | 115 | 87.3 | 117.1 | 80.5 | |
f | c | 115.3 | 91.6 | 114.8 | 91.1 | |
f | c | 124.4 | 92.5 | 123.3 | 96.7 | |
f | c | 115.5 | 85.5 | 119.7 | 77 | |
f | c | 119.6 | 99.6 | 117.4 | 105.5 | |
f | c | 108.3 | 92.1 | 110.4 | 87.8 | |
f | c | 115.1 | 89.1 | 116.1 | 95.4 | |
f | c | 122.3 | 87.7 | 121.2 | 92.1 | |
f | c | 113.1 | 85.3 | 113.2 | 92.1 | |
f | c | 120.5 | 96.4 | 117.6 | 90.6 |
I am saving the data file in excel with name 'data' on my desktop.
Use following command to import the data into R-
> library(readxl)
> data <-
read_excel("C:/Users/username/Desktop/data.xlsx")
--------------------------------------------
Once, you have the data in R, you use the following codes for each part-
44)
Use the code -
> mean(data$sbp.pre[data$arm=="t"]-data$sbp.post[data$arm=="t"])
This will give you the output -
[1] 2.212
Which means option (B) is correct.
-----------------------------------------------
45)
Use the code -
> t.test(data$sbp.pre[data$arm=="t"],data$sbp.post[data$arm=="t"], conf.level = 0.95, paired = TRUE)
The output we get is-
This should give you the required confidence interval as-
95 percent confidence interval:
(1.432866, 2.991134)
So, option (d) is correct.
----------------------------------------------------
46)
For the same code in previous part, you get the test statistic = 5.8595
So, option (c) is correct.
------------------------------------------
47)
Again, degree of freedom = df = 24. (obtained from the same output)
So, option (c) is correct.
--------------------------------------------
48)
The p-value from the output = 4.818 x 10-6
So, option (b) is correct.