-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path2 sample T test.R
More file actions
43 lines (32 loc) · 1.64 KB
/
2 sample T test.R
File metadata and controls
43 lines (32 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
######################2 sample T- Test(Promotion)#################################
library(readxl)
Promotion<-read_excel("C:/Users/HP/Desktop/datasets/Promotion.xlsx")# Promotion.xlsx
View(Promotion)
attach(Promotion)
colnames(Promotion)<-c("Credit","Promotion.Type","InterestRateWaiver","StandardPromotion")
View(Promotion)
colnames(Promotion)
attach(Promotion)
#############Normality test###############
shapiro.test(InterestRateWaiver)
# p-value = 0.2246 >0.05 so p high null fly => It follows normal distribution
shapiro.test(StandardPromotion)
# p-value = 0.1916 >0.05 so p high null fly => It follows normal distribution
#############Variance test###############
var.test(InterestRateWaiver,StandardPromotion)#variance test
# p-value = 0.653 > 0.05 so p high null fly => Equal variances
############2 sample T Test ##################
t.test(InterestRateWaiver,StandardPromotion,alternative = "two.sided",conf.level = 0.95,correct = TRUE)#two sample T.Test
# alternative = "two.sided" means we are checking for equal and unequal
# means
# null Hypothesis -> Equal means
# Alternate Hypothesis -> Unequal Hypothesis
# p-value = 0.02523 < 0.05 accept alternate Hypothesis
# unequal means
?t.test
t.test(InterestRateWaiver,StandardPromotion,alternative = "greater",var.equal = T)
# alternative = "greater means true difference is greater than 0
# Null Hypothesis -> (InterestRateWaiver-StandardPromotion) < 0
# Alternative Hypothesis -> (StandardPromotion - InterestRateWaiver) > 0
# p-value = 0.01211 < 0.05 => p low null go => accept alternate hypothesis
# InterestRateWaiver better promotion than StandardPromotion