Professional Documents
Culture Documents
Practical-10
Practical-10
Prisha Vaswani
11/8/2022
library(readxl)
data <- read_excel("D:/3rd semester/R/prac10data.xlsx")
The normal
quantile plot shows that all the points fall amost in a straight line , hence we can say that
the distribution of data is not significantly different from the normal distribution.
This can be confirmed using shapiro-wilk’s test.
H0: Distribution is normally distributed. H1: Distribution is not normally distributed.
shapiro.test(data$`Premodule score`-data$`Post module score`)
##
## Shapiro-Wilk normality test
##
## data: data$`Premodule score` - data$`Post module score`
## W = 0.96205, p-value = 0.5856
Since , p value is greater than 0.05. Therefore, The data is not significantly different from a
normal distribution.
Since , both the assumptions are satisfied we can conduct a paired t test.
H0: There is no significant difference in the mean marks pre and post module. H1: There is
a significant difference in the mean marks pre and post module.
t.test(data$`Premodule score`,data$`Post module
score`,paired=TRUE,alternative="two.sided")
##
## Paired t-test
##
## data: data$`Premodule score` and data$`Post module score`
## t = -3.2796, df = 19, p-value = 0.003942
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -3.4401893 -0.7598107
## sample estimates:
## mean of the differences
## -2.1
Since , the p value is less than 0.05 , we reject the null hypothesis. Therefore , there is
strong evidence that on average the module leads to improvements.
t.test(data$`Premodule score`,data$`Post module
score`,paired=TRUE,alternative="two.sided",conf.level = 0.95)
##
## Paired t-test
##
## data: data$`Premodule score` and data$`Post module score`
## t = -3.2796, df = 19, p-value = 0.003942
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -3.4401893 -0.7598107
## sample estimates:
## mean of the differences
## -2.1
##
## Paired t-test
##
## data: data$`Premodule score` and data$`Post module score`
## t = -3.2796, df = 19, p-value = 0.003942
## alternative hypothesis: true difference in means is not equal to 0
## 99 percent confidence interval:
## -3.931892 -0.268108
## sample estimates:
## mean of the differences
## -2.1
Interpretation:
Premodule and post module scores are positively correlated.
Significance of Correlation coefficient Our hypothesis will be
H0 ∶ ρ = 0 H1 ∶ ρ ≠ 0
cor.test(data$`Premodule score`,data$`Post module score`)
##
## Pearson's product-moment correlation
##
## data: data$`Premodule score` and data$`Post module score`
## t = 4.412, df = 18, p-value = 0.0003364
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.4086231 0.8819948
## sample estimates:
## cor
## 0.7208049
Conclusion value 0.0003364 is less than the chosen level of significance (0.05). We reject
the hypothesis, correlation is significant.
The 95% confidence interval is 0.4086231 and 0.8819948.
cor.test(data$`Premodule score`,data$`Post module score`,conf.level = 0.99)
##
## Pearson's product-moment correlation
##
## data: data$`Premodule score` and data$`Post module score`
## t = 4.412, df = 18, p-value = 0.0003364
## alternative hypothesis: true correlation is not equal to 0
## 99 percent confidence interval:
## 0.2771460 0.9111149
## sample estimates:
## cor
## 0.7208049