BPdata <- read.csv(file="C:/Users/91999/OneDrive/Documents/New folder/data.csv")
View(BPdata)
attach(BPdata)
names(BPdata)
##  [1] "Patient_Number"                "Blood_Pressure_Abnormality"   
##  [3] "Level_of_Hemoglobin"           "Genetic_Pedigree_Coefficient" 
##  [5] "Age"                           "BMI"                          
##  [7] "Sex"                           "Pregnancy"                    
##  [9] "Smoking"                       "Physical_activity"            
## [11] "salt_content_in_the_diet"      "alcohol_consumption_per_day"  
## [13] "Level_of_Stress"               "Chronic_kidney_disease"       
## [15] "Adrenal_and_thyroid_disorders"
#Ho : mu<8 + 95% confidence interval
t.test(Blood_Pressure_Abnormality, mu = 8,alternative="two.side",conf.level =0.95)
## 
##  One Sample t-test
## 
## data:  Blood_Pressure_Abnormality
## t = -671.29, df = 1999, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 8
## 95 percent confidence interval:
##  0.47157 0.51543
## sample estimates:
## mean of x 
##    0.4935
boxplot(Level_of_Hemoglobin ~Blood_Pressure_Abnormality)

#Ho : Mean of smokers = Mean of Non-Smokers
#assumption - non-equal variances

t.test(Level_of_Hemoglobin ~Blood_Pressure_Abnormality, mu=0, alt="two.side", paired=F, conf.level=0.95)
## 
##  Welch Two Sample t-test
## 
## data:  Level_of_Hemoglobin by Blood_Pressure_Abnormality
## t = -6.2473, df = 1438.2, p-value = 5.487e-10
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  -0.8014481 -0.4184199
## sample estimates:
## mean in group 0 mean in group 1 
##        11.40903        12.01897
#By default values which t.test takes are mention in the above line
t.test(salt_content_in_the_diet ~ Adrenal_and_thyroid_disorders )
## 
##  Welch Two Sample t-test
## 
## data:  salt_content_in_the_diet by Adrenal_and_thyroid_disorders
## t = -0.89078, df = 1884.7, p-value = 0.3732
## alternative hypothesis: true difference in means between group 0 and group 1 is not equal to 0
## 95 percent confidence interval:
##  -1828.0846   686.1352
## sample estimates:
## mean in group 0 mean in group 1 
##        24672.87        25243.84
t.test(Level_of_Hemoglobin[Blood_Pressure_Abnormality=='0'], Level_of_Hemoglobin[Blood_Pressure_Abnormality=='1'])
## 
##  Welch Two Sample t-test
## 
## data:  Level_of_Hemoglobin[Blood_Pressure_Abnormality == "0"] and Level_of_Hemoglobin[Blood_Pressure_Abnormality == "1"]
## t = -6.2473, df = 1438.2, p-value = 5.487e-10
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.8014481 -0.4184199
## sample estimates:
## mean of x mean of y 
##  11.40903  12.01897