Looking at the normal probablity plot(s) (NPP) of the US and Japanese cars for MPG of the current sample size we can see that the US car MPG NPP does not exhibit uniform normality. We can see that the data is skewed on the left end as well as the right end out the data. We see that the data curves upwards and away for the reference line where those points can be seen as outliers or a skewness to the plots. Now when looking at the Japanase Car MPG NPP we can see taht it is approximately normal in terms of data distribution along the reference line. However we still see where it curves downward towards the end of the reference line. Both of these data sets will need to have a log transformation applied in order for a standard pooled two-sample t-test to be done.
By looking at the side by side box plots of the US cars and Japanese Cars we can see that the Japanese Cars have more variability than the US cars. And varience does not appear to be constant across both sets fo data, however for the US cars it is more constant than the Japanese Cars data set.
The differences between these plots looks to be that the the US Cars NPP has gained more normality by making the curved upwardness of the plot come in more diagonal and closer to the reference line on the plot. Now with the Japanese Cars NPP we can see that with the log transformation it pulls the data points on the lower left of the plot away from the reference line and introduces some skewness to the data set. When looking at the box plots we can see that the US cars only had a slight change with it bringing the variance slightly. Now with the Japanese Cars box plot we can see that the data has been pulled in and our variance is lower than before the log transformation.
The Null Hypothesis is the mean log of MPG of US cars is greater than or equal to that of Japanese Cars.
The Alternative Hypothesis is the mean log of MPG of US Cars is strictly less than that of Japanese Cars.
##
## Welch Two Sample t-test
##
## data: datalog_US and datalog_Jap
## t = -9.804, df = 60.651, p-value = 4.015e-14
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.6380580 -0.4218536
## sample estimates:
## mean of x mean of y
## 2.741001 3.270957
From the data we can see that our p-value is almost zero essentially, so with that we are able to reject the Null Hypothesis where the mean log of US Cars MPG is greater than the mean log MPG of Japanese Cars. Which leads us to accect the the alternative hypothesis which says the log mean of US cars is strictly less than the log mean of Japanese cars. And we do see this where the US Cars log mean is 2.74 and the Japanese Cars log mean is 3.27. This gives us statistical evidence to say that the alternative hypothesis is true based on the data set that is used.
data1 <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/US_Japanese_Cars.csv")
rmarkdown::paged_table(data1)
qqnorm(data1$USCars, main = "NPP for US Cars")
qqline(data1$USCars)#adds reference line to plot
qqnorm(data1$JapaneseCars, main = "NPP for Japanese Cars")
qqline(data1$JapaneseCars)# adds reference line to plot
boxplot(data1$USCars, data1$JapaneseCars,
names = c("US Cars","Japanese Cars"),
main = "Comparison of MPG",
ylab = "Mile Per Gallon",
col = c("blue","green"),
na.action = na.omit)#omits NA from Data
datalog_US <- log(data1$USCars)
qqnorm(datalog_US, main = "NPP of Log US Cars")
qqline(datalog_US)
datalog_Jap <- log(na.omit(data1$JapaneseCars))
qqnorm(datalog_Jap, main = "NPP of Log Japanese Cars")
qqline(datalog_Jap)
boxplot(datalog_US, datalog_Jap,
names = c("US Cars", "Japanese Cars"),
main = "Comparison of MPG",
ylab = "Miles Per Gallon",
col = c("blue","green"),
na.action = na.omit)#omits NA from data
t.test(datalog_US, datalog_Jap,
conf.level = .95)