A medical researcher conjectures that the likelihood of having wrinkled skin around the eyes increases when a person smokes. The smoking habits as well as the presence of prominent wrinkles around the eyes were recorded for 500 randomly selected people from the population of interest. The following frequency table is obtained:
| Prominent Wrinkles | Wrinkles not prominent | |
|---|---|---|
| Heavy smoker | 95 | 55 |
| Light smoker | 75 | 75 |
| Non-smoker | 66 | 134 |
a1) State the hypotheses (Ho and Ha).
Ho: Skin wrinkles and smoking habits are independent.
Ha: Skin wrinkles depends on smoking habits
a2) Whether you reject or fail to reject Ho and why.
matrix_smoker_wrinkles = matrix(c(95,55,75,75,66,134), nrow=3, byrow=TRUE, dimnames= list(c("Heavy smoker","Light smoker","Non-smoker"),c("Prominent Wrinkles","Wrinkles not prominent")))
matrix_smoker_wrinkles
## Prominent Wrinkles Wrinkles not prominent
## Heavy smoker 95 55
## Light smoker 75 75
## Non-smoker 66 134
chisq.test(matrix_smoker_wrinkles)$expected
## Prominent Wrinkles Wrinkles not prominent
## Heavy smoker 70.8 79.2
## Light smoker 70.8 79.2
## Non-smoker 94.4 105.6
chisq.test(matrix_smoker_wrinkles, correct = FALSE)
##
## Pearson's Chi-squared test
##
## data: matrix_smoker_wrinkles
## X-squared = 32.32, df = 2, p-value = 9.59e-08
p-value = 9.59e-08
Since P-value is less than alpha (0.05), we reject Ho and support Ha,
a3) Your conclusion (i.e., whether smoking is associated with having wrinkles).
The data supports that skin wrinkles are caused by smoking
chisq.test(matrix_smoker_wrinkles, correct = FALSE)$residuals
## Prominent Wrinkles Wrinkles not prominent
## Heavy smoker 2.8760653 -2.7192728
## Light smoker 0.4991518 -0.4719399
## Non-smoker -2.9230237 2.7636713
The data shows that non-smokers are positive correlated with not prominent skin wrinkles, and Heavy and light smoker are positive correlated with prominent wrinkles. Also Heavy smokers are much related with prominent wrinkles than Light smokers.
A researcher wants to compare the average anxiety levels of people living in Alaska and Hawaii. The researcher does not have any specific hypothesis in mind in terms of which state could have higher mean anxiety levels. She collected data on anxiety scores for two samples of randomly selected residents from both states. Each resident was given a score between 0 to 100 (higher scores mean more anxiety).
The anxiety scores she collected for each state are shown next. Create two vectors in R with these data (one vector for Alaska scores and another one for Hawaii scores).
Alaska scores: 69 76 64 65 67 77 56 67 62 82 56 77 71 68 76 69 64 66 83 77 75 79 71 75 86 67 70 73 77 71 78 64 62 58 67
Hawai scores: 64 76 74 74 73 71 75 63 67 77 74 67 69 70 64 72 72 72 74 76 67 69 80 73 68 77 71 73 69 68 71 71 73 75 71
Assume that the variables involved in this problem follow a normal distribution. Also assume their variances can be safely considered to be the same (in other words, you do NOT need to do the test to compare two variances here. Assume that the variances are equal).
alaska_scores = c(69, 76, 64, 65, 67, 77, 56, 67, 62, 82, 56, 77, 71, 68, 76, 69, 64, 66, 83, 77, 75, 79, 71, 75, 86, 67, 70, 73, 77, 71, 78, 64, 62, 58, 67)
hawaii_scores = c(64, 76, 74, 74, 73, 71, 75, 63, 67, 77, 74, 67, 69, 70, 64, 72, 72, 72, 74, 76, 67, 69, 80, 73, 68, 77, 71, 73, 69, 68, 71, 71, 73, 75, 71)
Ho: The level of anxiety in Alaska is less or equal than Hawaii
Ha: The level of anxiety in Alaska is greater than Hawaii
t.test (alaska_scores, hawaii_scores, alternative = "greater", var.equal = TRUE)
##
## Two Sample t-test
##
## data: alaska_scores and hawaii_scores
## t = -0.70165, df = 68, p-value = 0.7574
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## -3.376634 Inf
## sample estimates:
## mean of x mean of y
## 70.42857 71.42857
Since P-value(0.7574) is greater than alpha(0.5), we cannot reject Ho. We conclude that the level of anxiety in Alaska is less or equal to Hawaii
t.test (alaska_scores, hawaii_scores, var.equal = TRUE, conf.level = 0.95)$conf.int
## [1] -3.843955 1.843955
## attr(,"conf.level")
## [1] 0.95
Since the CI doesn’t contain the zero, we can conclude that the average level of anxiety are different between Alaska and Hawaii.
Consider a research study where the goal is to test whether nightly melatonin supplementation improves sleep (i.e., if it increases the amount of sleep time). The authors report the following result:
“In comparison with placebo, a 3 weeks of melatonin supplementation significantly increased the average sleep time (amount of increase= 36 min; P value = 0.046).”
Answer the following questions:
They conducted a two means test, because they were comparing the average sleeping time of people with a melatonin supplementation and a placebo group.
Ho: Melatonin supplementation doesn’t not improve sleeping time (less or equal sleep time)
Ha: Melatonin supplementation improves sleeping time (more sleep time)
If they take an alpha of 0.05, p-value will be lower than alpha; therefore they could reject Ho and support Ha
The results after rolling a die 300 times are shown in the next table:
| 1’s | 2’s | 3’s | 4’s | 5’s | 6’s | |
|---|---|---|---|---|---|---|
| Frequency | 45 | 52 | 50 | 58 | 55 | 40 |
Is there sufficient evidence to conclude that a loaded die was used in this experiment? Justify by doing the relevant hypothesis test and showing all your work. You must state both hypotheses when doing the hypothesis test.
Note: A normal (not loaded) die is one with equal probability for all the faces of the die.
Ho: Probability of each number is 1/6
Ha: At least of one the probabilities is different from what we suspect/expect.
rolls = c(45, 52, 50, 58, 55, 40)
prob = rep(1/6,6)
Are all the expected counts greater than or equal to 5? Yes
chisq.test(rolls, p=prob)$expected
## [1] 50 50 50 50 50 50
Let’s run the test:
chisq.test(rolls, p=prob, correct= FALSE)
##
## Chi-squared test for given probabilities
##
## data: rolls
## X-squared = 4.36, df = 5, p-value = 0.4988
p-value = 0.4988
Since P-Value is greater than alpha(0.05) we cannot reject Ho, therefore the dice they used in the experiment was not loaded