Hypothesis testing using R

Question 1

A manufacturing plant makes 12V DC motors for large industrial equipment. The management n=100 motors from the process. Specifically, they would like to test whether the mean voltage of the manufactured motors is less than 12V with a 0.05 level of significance. The datafile of collected observations may be found hereof the company would like to assess production quality and have decided to randomly sample:

knitr::opts_chunk$set(echo = TRUE)
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/DC_Motors_Voltage.csv")
str(dat)
## 'data.frame':    100 obs. of  1 variable:
##  $ Voltage: num  12.6 11.9 12.3 12 11.8 ...
t.test(dat, mu=12, alternative = "less" ) #fail to reject H0 
## 
##  One Sample t-test
## 
## data:  dat
## t = 2.7666, df = 99, p-value = 0.9966
## alternative hypothesis: true mean is less than 12
## 95 percent confidence interval:
##      -Inf 12.13553
## sample estimates:
## mean of x 
##   12.0847

Analysis

\[ Ho:\mu=12\] \[ Ha:\mu\ne12 \]

Parameters

\[ p_{-value}=0,9996, t=2,7666, mean=12,0847\]

Conclusion

Since p-value > 0.05 H0 is rejected which means the mean voltage of the manufactured motors is less than 12V with a 0.05 level of significance.

Question 2

The resting body temperature of humans is assumed to be 98.6 degrees Fahrenheit. We would like to test this assumption against the alternative that it differs for females from 98.6 degrees at a 0.10 level of significance. The datafile of collected observations may be found here:

knitr::opts_chunk$set(echo = TRUE)
dat1 <-read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
str(dat1$Temp)
##  num [1:130] 96.3 96.7 96.9 97 97.1 97.1 97.1 97.2 97.3 97.4 ...
t.test(dat1$Temp, mu=98.6, alternative = "two.sided") #reject H0
## 
##  One Sample t-test
## 
## data:  dat1$Temp
## t = -5.4548, df = 129, p-value = 2.411e-07
## alternative hypothesis: true mean is not equal to 98.6
## 95 percent confidence interval:
##  98.12200 98.37646
## sample estimates:
## mean of x 
##  98.24923

Analysis

\[ Ho:\mu=98.6\] \[ Ha:\mu\ne98.6 \]

Parameters

\[ p_{-value}=2,4111\times 10^{-7}, t=-5,4548, mean=98,24923 \]

Conclusion

Since p-value > 0.10 H0 is fail to rejected which means that there is no enough information to confirm that the resting body temperature of humans is 98.6 degrees Fahrenheit.

R CODE Used

#Question 1
dat <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/DC_Motors_Voltage.csv")
str(dat)
t.test(dat, mu=12, alternative = "less" ) #fail to reject H0 


#Question 2
dat1 <-read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
str(dat1$Temp)
t.test(dat1$Temp, mu=98.6, alternative = "two.sided") #reject H0