#reading the CSV File
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/US_Japanese_Cars.csv")
us <- dat [,1]
japan <- dat [1:28,2]
us
## [1] 18 15 18 16 17 15 14 14 14 15 15 14 15 14 22 18 21 21 10 10 11 9 28 25 19
## [26] 16 17 19 18 14 14 14 14 12 13
japan
## [1] 24 27 27 25 31 35 24 19 28 23 27 20 22 18 20 31 32 31 32 24 26 29 24 24 33
## [26] 33 32 28
qqnorm(us,main = ("Normal Plot for US Cars"),col = "Red")
qqnorm(japan,main = ("Normal Plot for Japanesse Cars"),col = "Blue")
boxplot(us,japan,
col = c("Red", "Blue"),
main = "BoxPlot: US and Japanesse Car")
luscar <- log(us)
ljapancar <- log(japan)
luscar
## [1] 2.890372 2.708050 2.890372 2.772589 2.833213 2.708050 2.639057 2.639057
## [9] 2.639057 2.708050 2.708050 2.639057 2.708050 2.639057 3.091042 2.890372
## [17] 3.044522 3.044522 2.302585 2.302585 2.397895 2.197225 3.332205 3.218876
## [25] 2.944439 2.772589 2.833213 2.944439 2.890372 2.639057 2.639057 2.639057
## [33] 2.639057 2.484907 2.564949
ljapancar
## [1] 3.178054 3.295837 3.295837 3.218876 3.433987 3.555348 3.178054 2.944439
## [9] 3.332205 3.135494 3.295837 2.995732 3.091042 2.890372 2.995732 3.433987
## [17] 3.465736 3.433987 3.465736 3.178054 3.258097 3.367296 3.178054 3.178054
## [25] 3.496508 3.496508 3.465736 3.332205
qqnorm(luscar,main = ("Normal Plot for Log US Cars"),col = "Red")
qqnorm(ljapancar,main = ("Normal Plot for Log Japanesse Cars"),col = "Blue")
boxplot(luscar,ljapancar,
col = c("Red", "Blue"),
main = "BoxPlot: Log US and Japanesse Car")
mus <- mean(luscar)
mjapan <- mean(ljapancar)
result <- t.test(luscar, ljapancar, alternative =c("less"),mu =0,paired = FALSE, var.equal = TRUE)
result
##
## Two Sample t-test
##
## data: luscar and ljapancar
## t = -9.4828, df = 61, p-value = 6.528e-14
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf -0.4366143
## sample estimates:
## mean of x mean of y
## 2.741001 3.270957
As the P- value is less than 0.05 thus, we reject the null hypothesis and conclude that there is strong evidence to support that mean log MPG of US cars is significantly less than of Japanese cars.