Paried T Test
Paried T Test
S.No 1 2 3 4 5 6 7 8 9 10
Before 200.1 190.9 192.7 213 241.4 196.9 172.2 185.5 205.2 193.7
After 392.9 393.2 345.1 393 434 427.9 422 383.9 392.3 352.2
AIM:
To find the paired t-test for the given data by using R-coding.
Hypothesis:
Paired t-test
data: before and after
t = -20.883, df = 9, p-value = 6.2e-09
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
-215.5581 -173.4219
sample estimates: mean difference
-194.49
Interpretation of results
The p-value of the test is 6.2e-09, which is less than the significance level
alpha = 0.05.
Interpretation of results
The p-value of the test is 7.953e-06, which is less than the significance level
alpha = 0.05. We can then reject null hypothesis.
There is significant difference between potato yield and standard yield.
EX:08
Two sample t-test
Problem:
Six subjects were given a drug (trearment group) and an additional 6 subjects a placebo
(control group).Their reaction time to stimulus was measured (in ms).We want to perform a two
sample t-test for comparing the means of the treatment and control groups.
Control 91 87 99 77 88 91
Aim:
To find the two-sample t-test for the given data by using R-coding.
Hypothesis:
❖ alternative: the alternative hypothesis. Allowed value is one of “two.sided” (default), “greater”
or “less”.
❖ var.equal: a logical variable indicating whether to treat the two variances as being equal. If
TRUE then the pooled variance is used to estimate the variance otherwise the Welch test is used.
Algorithm:
❖ Interpretation of results.
INPUT:
# Data in two numeric vectors
control= c(91,87,99,77,88,91)
treatment = c(101,110,103,93,99,104)
# Shapiro-Wilk normality test for treatment and control groups
shapiro.test(control)
shapiro.test(treatment)
# Compute Two-sample t-test
tworesult <- t.test(control, treatment, var.equal = TRUE)
# Printing the results
tworesult
OUTPUT:
Shapiro-Wilk normality test
Shapiro-Wilk normality test
data: control
W = 0.93942, p-value = 0.6545
data: treatment
W = 0.98231, p-value = 0.9624
# Printing the results
Two Sample t-test
data: control and treatment
t = -3.4456, df = 10, p-value = 0.006272
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-21.132133 -4.534534
sample estimates:
mean of x mean of y
88.83333 101.66667
Interpretation of results
The p-value of the test is 0.006, which is less than the significance level
alpha = 0.05. We can then reject null hypothesis.