library(lawstat)
Aspirin_A <-c(15,26,13,28,17,20,7,36,12,18)
Aspirin_B <-c(13,20,10,21,17,22,5,30,7,11)
t.test(Aspirin_A, Aspirin_B,paired=TRUE, level=0.05) #reject Ho
##
## Paired t-test
##
## data: Aspirin_A and Aspirin_B
## t = 3.6742, df = 9, p-value = 0.005121
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 1.383548 5.816452
## sample estimates:
## mean of the differences
## 3.6
t.test(Aspirin_A, Aspirin_B, var.equal = TRUE)
##
## Two Sample t-test
##
## data: Aspirin_A and Aspirin_B
## t = 0.9802, df = 18, p-value = 0.34
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -4.116103 11.316103
## sample estimates:
## mean of x mean of y
## 19.2 15.6
\[ Ho:\mu T,male= \mu T,female\] \[ Ha:\mu T,male \ne\ \mu T,female\]
temp <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
male <- temp[1:65,]
female <- temp[66:130,]
boxplot(male$Temp,female$Temp, names = c("Male", "Female"), ylab="Temperature")
t.test(male$Temp,female$Temp,var.equal=TRUE)
##
## Two Sample t-test
##
## data: male$Temp and female$Temp
## t = -2.2854, df = 128, p-value = 0.02393
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.53963938 -0.03882216
## sample estimates:
## mean of x mean of y
## 98.10462 98.39385
t.test(male$Temp,female$Temp,var.equal=FALSE)
##
## Welch Two Sample t-test
##
## data: male$Temp and female$Temp
## t = -2.2854, df = 127.51, p-value = 0.02394
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.53964856 -0.03881298
## sample estimates:
## mean of x mean of y
## 98.10462 98.39385
library(lawstat)
Aspirin_A <-c(15,26,13,28,17,20,7,36,12,18)
Aspirin_B <-c(13,20,10,21,17,22,5,30,7,11)
t.test(Aspirin_A, Aspirin_B,paired=TRUE, level=0.05) #reject Ho
#Conclusions: there is significative differences between mean of Aspirin A in
# in comparison with Aspirin B with a 95% of significance
t.test(Aspirin_A, Aspirin_B, var.equal = TRUE)
#Conclusion: p-value iqual to 0.34 and fail to reject H0
#Question 2
temp <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
male <- temp[1:65,]
female <- temp[66:130,]
boxplot(male$Temp,female$Temp, names = c("Male", "Female"), ylab="Temperature")
#The mean for males is lower in comparison with the mean for females, also there some outliers points for the temperature for females
#H0: uT,male =uT,females
#Ha: uT,male =/ uT,females
t.test(male$Temp,female$Temp,var.equal=TRUE)
#since p-value = 0.02394 reject H0 which means that male and female means are different with a 95% of significance
t.test(male$Temp,female$Temp,var.equal=FALSE)