-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextra_problems
117 lines (87 loc) · 6.71 KB
/
extra_problems
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
### 1) Consider the dataset `palmerpenguins` in the packages `palmerpenguins`.Represent the bill length for species Gentoo and Chinstrap. We would like to test that the true difference in means for variable `bill_length_mm`
between group Chinstrap and group Gentoo is greater than 0
<codeblock id="01_01">
Check the argument `alternative` in the documentation of function `t.test` (You can find the documentation with `?t.test` )
</codeblock>
suggests that one would expect 12.5 significant tests even in the purely null
case, merely by chance. In that sense, finding only 11 significant results is
actually somewhat disappointing!
<choice id="3">
<opt text="As the probability of failing to reject a null hypothesis that is actually false (type I error) increases with the number of tests, one should consider the corrected p-values that are larger than the uncorrected ones.">
</opt>
<opt text="As the probability of rejecting a null hypothesis that is actually true (type I error) increases with the number of tests, one should consider the corrected p-values that are larger than the uncorrected ones." correct="true">
</opt>
<opt text="As the probability of rejecting a null hypothesis that is actually true (type I error) increases with the number of tests, one should consider the corrected p-values that are smaller than the uncorrected ones." >
</opt>
<opt text="There is no need to correct p-values when performing multiple testing." >
</opt>
</choice>
### 4) Load the package `palmerpenguins` and the dataset `penguins` with `df = palmerpenguins::penguins`. Consider the variable `bill_length_mm` and represent the variable graphically. Use the appropriate test to check if there is evidence of difference in the location of the distributions of the variable `bill_length_mm` between species. Correct the resulting p-values with the function `p.adjust` and interpret the results.
<codeblock id="02_02">
We should first check if there is significant difference in the location of `bill_length_mm` for all species. If so, then we should test in pairs to compare the location of `bill_length_mm` between each pair of species.
</codeblock>
### 2) Load the package `idarps` and the dataset `cortisol` with `data(cortisol)`. Consider the variable `Urine Cortisol (pg/mg)` and represent the variable graphically. Consider that you would like to test if there is evidence of a difference in the means of the variable `Urine Cortisol (pg/mg)` between the groups `C` and `NC`. Perform the adapted test given the distribution of the variable and interpret the result.
<codeblock id="02_01">
Check the distribution and the variance of the variable `Urine Cortisol (pg/mg)` to decide which test to apply.
</codeblock>
### 1) Suppose that you want to compare the means of 3 groups. The variables of interest to fo to have aproximately normally distributed (and there are no clear outliers), but you notice that the variances appear to be different between groups. In this case, which test should you consider and why?
<choice id="chap2_exc3">
<opt text="You should consider the two independent sample Student's t-tests because the data are approximately normally distributed."> Nope, as the variances are different.
</opt>
<opt text="Because you want to compare more than 2 groups, the data seem to be approximately normally distributed, and the variances between groups are different, you should consider the Welch's one-way ANOVA." correct="true"> 👍
</opt>
<opt text="You should consider the two independent sample Welch's t-test because the variances are different between groups." >
</opt>
<opt text="As you compare more than 2 groups and that the data seem to be approximately normally distributed, you should consider the Fisher one-way ANOVA." >
</opt>
</choice>
### 4) Which statements following is true?
<choice id="2">
<opt text="A test is of significant level alpha when the probability of making a type I error equals 1-alpha." >
</opt>
<opt text="A test is of power beta when the probability to make a type II error is 1-beta." correct="true">
</opt>
<opt text="A test is of significant level alpha when the probability of making a type II error equals 1-alpha.">
</opt>
<opt text="A test is of power beta when the probability to make a type II error is beta.">
</opt>
</choice>
### 1) We saw previously, that diet B (in the dataset `diet` of the `idarps` package) was effective in reducing the weights of the participents. Is it also the case when only the women in the study are considered? Complete the code below and comment on the results.
<codeblock id="01_02">
</codeblock>
### 1) Consider the boxplots of data associated with two groups: "treatment" and "control". Consider that you want to test the difference in the central value of both distributions. What test should you consider and why?
<div style="text-align:center">
<img src="plot1.png" alt=" " width="55%">
</div>
<choice id="6">
<opt text="One should consider a t-test because we want to test the difference in their central value." >
</opt>
<opt text="We should consider a t-test because there are some extreme observations in the control group" >
</opt>
<opt text="We should consider a Wilcoxon rank test because the extreme observations in the control group suggest that the data are not normally distributed and we would prefer to rely on a non-parametric test" correct="true">
</opt>
<opt text="We don't need to test anything because it is clear on the graph that the median of the control group is above the median of the treatment group.">
</opt>
</choice>
---
# .smaller[Exercise: Urine Cortisol vs Chips]
.panelset[
.panel[.panel-name[Problem]
A researcher in Nutrition Science is interested in studying the effects of consuming .pink[fried food on human's health]. To study this issue, this researcher conducted an experiment on 61 pigs which are randomly assigned with .pink[Chips] and .purple2[Non-Chips] diets. Then, the following variables were measured: `group` (C for Chips, NC for Non-Chips), `gender` and several hormones (`urine_cortisol`, `serum_cortisol`, `ACTH`, `CRH`, `testosterone` and `LH`). Based on this data, can we conclude that fried food group (i.e. Chips) has increased level of urine cortisol compared to the control?
]
.panel[.panel-name[Import]
```{r}
# Import data
cortisol_data = read.csv("data/cortisol.csv", row.names=1)
# Create data frame
dat = data.frame(group = cortisol_data$group,
gender = cortisol_data$gender,
urine_cortisol = cortisol_data$Urine.Cortisol..pg.mg.,
serum_cortisol = cortisol_data$Serum.Cortisol..ng.ml.,
ACTH = cortisol_data$Serum.ACTH..pg.ml.,
CRH = cortisol_data$Serum.CRH..pg.ml.,
testosterone = cortisol_data$Testosterone..ng.ml.,
LH = cortisol_data$LH..ng.ml.)
```
]
]