In: Statistics and Probability
1a. Construct a 99% confidence interval for proportion of obese people in the population the above sample was taken. (BMI>29.5 is counted as ob
1.b Is there any evidence to show there is difference between proportion of smokers between male and female? Apply appropriate test with alpha=0.05. |
USE R AND SHOW CODES
Male=1, Female=0 |
Smoker=1, Nonsmoker=0 |
DATA
sex | age | currentSmoker | BMI |
1 | 39 | 0 | 26.97 |
0 | 46 | 0 | 28.73 |
1 | 48 | 1 | 25.34 |
0 | 61 | 1 | 28.58 |
0 | 46 | 1 | 23.1 |
0 | 43 | 0 | 30.3 |
0 | 63 | 0 | 33.11 |
0 | 45 | 1 | 21.68 |
1 | 52 | 0 | 26.36 |
1 | 43 | 1 | 23.61 |
0 | 50 | 0 | 22.91 |
0 | 43 | 0 | 27.64 |
1 | 46 | 1 | 26.31 |
0 | 41 | 0 | 31.31 |
0 | 39 | 1 | 22.35 |
Result:
1.b Is there any evidence to show there is difference between proportion of smokers between male and female? Apply appropriate test with alpha=0.05.
R code:
sex <- c(1,0,1,0,0,0,0,0,1,1,0,0,1,0,0)
smoker <- c(0,0,1,1,1,0,0,1,0,1,0,0,1,0,1)
mydata <- data.frame(sex,smoker)
# to get frequencies
freq <-table(mydata$sex, mydata$smoker)
freq
R output:
freq
0 1
0 6 4
1 2 3
Frequencies: out of 5 males, 3 are smokers. out of 10 females, 4 are smokers.
R code:
#proportion test
prop.test(c(3,4),c(5,10),correct=FALSE)
R output:
2-sample test for equality of proportions without continuity
correction
data: c(3, 4) out of c(5, 10)
X-squared = 0.53571, df = 1, p-value = 0.4642
alternative hypothesis: two.sided
95 percent confidence interval:
-0.3259135 0.7259135
sample estimates:
prop 1 prop 2
0.6 0.4
Calculated chi square = 0.53571, P=0.4642 which is > 0.05 level of significance. Ho is not rejected.
There is no evidence to show that there is difference between proportion of smokers between male and female.