Biostatistics

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

One Sample T- Test & Paired Sample T-

Test
moderate=c(9.22,19.96,14.43,19.51,16.73,15.18)
severe=c(1.24,3.05,3.06,1.55,0.90,2.05)
one sample t test
> shapiro.test(moderate)

Shapiro-Wilk normality test

data: moderate
W = 0.92552, p-value = 0.546

> t.test(moderate)

One Sample t-test

data: moderate
t = 9.8552, df = 5, p-value = 0.0001833
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
11.70714 19.96953
sample estimates:
mean of x
15.83833
Interpretation:
Since the p-value is less than the common significance level of 0.05, we can reject the null
hypothesis, which states that the true mean food insecurity prevalence is equal to 0. Therefore,
based on this t-test, there is a significant difference between the food insecurity prevalence and
zero.
The 95% confidence interval (11.70714 to 19.96953) provides a range of values within which we
are 95% confident that the true population mean of food insecurity prevalence lies.
The sample mean estimate (15.83833) is the average food insecurity prevalence in the sample.
Overall, this t-test indicates that there is a statistically significant difference in the food insecurity
prevalence in different regions of the province of Pakistan, and the estimated average prevalence
is approximately 15.84. However, keep in mind that this interpretation is based on the
assumption that the data used in the t-test is representative and meets the assumptions of the t-
test. It is essential to have domain knowledge and understand the context of the data to make
meaningful conclusions and predictions based on the results.

paired sample t test


> before=moderate
> after=severe
> d=before-after
>d
[1] 7.98 16.91 11.37 17.96 15.83 13.13
> shapiro.test(d)
Shapiro-Wilk normality test
data: d
W = 0.94541, p-value = 0.7031

Interpretation:
Since the p-value of the Shapiro-Wilk test is 0.7031 (greater than 0.05), we fail to reject the null
hypothesis. This means that there is not enough evidence to conclude that the differences "d" are
significantly different from a normal distribution. Therefore, we can assume that the differences
follow a roughly normal distribution.
> t.test(before,after,paired = TRUE)
Paired t-test
data: before and after
t = 8.9925, df = 5, p-value = 0.0002838
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
9.900391 17.826276
sample estimates:
mean difference
13.86333
Interpretation:
The p-value (0.0002838) is less than the common significance level of 0.05, indicating that there
is strong evidence to reject the null hypothesis. Therefore, we can conclude that there is a
statistically significant difference between the "before" and "after" measurements of food
insecurity prevalence in the different regions of the province.
The 95% confidence interval (9.900391 to 17.826276) provides a range of values within which
we are 95% confident that the true mean difference between "before" and "after" lies.
The sample mean difference (13.86333) represents the average increase (or decrease) in food
insecurity prevalence from "before" to "after" in the paired regions.
Overall, this paired t-test suggests that there is a significant difference in food insecurity
prevalence between the "before" and "after" measurements, and on average, there is an increase
of approximately 13.86 in food insecurity prevalence from the "before" to the "after" situation or
time point.

You might also like