Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statistical models ws #22

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Statistical models ws #22

wants to merge 22 commits into from

Conversation

andr3wli
Copy link
Member

@andr3wli andr3wli commented Jul 5, 2021

completed the stat model workshop with some revisions from Gil.

Copy link
Member

@stephan-koenig stephan-koenig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Andrew,

I am sorry that it took me so long to start reviewing the material.

I noticed you had added extraneous files when you did the commit 5edafde818a2e725f2cc80868efa2fa1ec74d294:

._educer.Rproj
inst/resources/images/._pivot_longer.gif
inst/resources/images/._rstudio_install_packages.png
inst/resources/images/._rstudio_logo.png
inst/tutorials/tidyverse_ws/saanich.pdf
inst/tutorials/tidyverse_ws/tidyverse_ws.html
inst/tutorials/tidyverse_ws/tidyverse_ws_files/figure-html/unnamed-chunk-10-1.png
inst/tutorials/tidyverse_ws/tidyverse_ws_files/figure-html/unnamed-chunk-7-1.png
inst/tutorials/tidyverse_ws/tidyverse_ws_files/figure-html/unnamed-chunk-8-1.png

When creating a commit, make sure to look at the list of modified files and if you actually intend to adding them, i.e. do not just git add -A without checking the added files with git status. For example, you must have knit the tidyverse_ws.Rmd and created output files that were not really needed.

I only reviewed until the end of the one-way ANOVA exercise. It appears to me that you and Gil must never have code reviewed each other's code. 5 out of 7 code exercises did not work. I did fix most of them except the one in the first exercise.

Please first review and that add my changes. Do not add all suggestions as individual commits. See here how to batch suggestions in a single commit that belong, in your opinion, together.

Then please use the build pane to install the package and run the tutorial from the corresponding Tutorial pane. Check all other code chunks if they work. If not, please fix them, as I demonstrated in the few examples below.

Best,

Stephan

- Does the type sexual relationship practiced influence the fitness of male Red-winged Blackbirds?
- response variable: fitness of male bird (e.g., number of eggs laid)
- explanatory variable: sexual relationship (e.g., monagamy vs. polygamy)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


With ANOVA, you will determine to accept or reject the null hypothesis:
-   Null hypothesis $H_0$: population means of all groups are equal
-   Alternate hypothesis $H_1$: population means of at least two groups are not equal

Comment on lines +226 to +245
```{r two-group, exercise = TRUE}
# The response variable is on the left and explanatory variable on the right
fly_2_groups_model <- aov(<response_column> ~ <explanatory_column>,
data = <variable_name>)
```

```{r two-group-solution}
fly_2_groups_model <- aov(longevity ~ activity, data = fly_2_groups)
```

The `aov()` function returns a "model" object. You can examine the results of the model with the `summary()` function:

```{r two-group-sum, exercise = TRUE}
summary(<model_object>)
```

```{r two-group-sum-solution, excercise.setup = "setup-two-group-sum"}
summary(<fly_2_groups_model>)
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```{r two-group, exercise = TRUE}
# The response variable is on the left and explanatory variable on the right
fly_2_groups_model <- aov(<response_column> ~ <explanatory_column>,
data = <variable_name>)
```
```{r two-group-solution}
fly_2_groups_model <- aov(longevity ~ activity, data = fly_2_groups)
```
The `aov()` function returns a "model" object. You can examine the results of the model with the `summary()` function:
```{r two-group-sum, exercise = TRUE}
summary(<model_object>)
```
```{r two-group-sum-solution, excercise.setup = "setup-two-group-sum"}
summary(<fly_2_groups_model>)
```
```{r two-group, exercise = TRUE, exercise.setup = "setup-groups"}
# The response variable is on the left and explanatory variable on the right
fly_2_groups_model <- aov(<response_column> ~ <explanatory_column>,
data = <variable_name>)
summary(<model_object>)
```
```{r two-group-solution}
fly_2_groups_model <- aov(longevity ~ activity, data = fly_2_groups)
summary(fly_2_groups_model)
```

Only 2 out of 6 exercises have worked so far.

Comment on lines +249 to +274
#### **Exercise 1: 1-way ANOVA**
Using ANOVA, test if fruit fly longevity is affected by size (as measured by thorax length).

* What are your null and alternate hypotheses?
* What can you conclude from these results?

Create a model variable called `exercise1` and use the `summary()` function to examine the output.

**Note: Hints will be provided for exercises but no solution. Try to figure it out!**
```{r ex1, exercise = TRUE}
<model_object> <- aov(<response_column> ~ <explanatory_column>,
data = <variable_name>)
<function_for_examining_output>(<model_object>)
```

```{r ex1-hint-1}
# The response column is thorax and the exploratory column is thorax
```

```{r ex1-hint-2}
# Name the model object exercise1!
```

```{r ex1-hint-3}
# To examine the output of your model, use the summary() function!
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#### **Exercise 1: 1-way ANOVA**
Using ANOVA, test if fruit fly longevity is affected by size (as measured by thorax length).
* What are your null and alternate hypotheses?
* What can you conclude from these results?
Create a model variable called `exercise1` and use the `summary()` function to examine the output.
**Note: Hints will be provided for exercises but no solution. Try to figure it out!**
```{r ex1, exercise = TRUE}
<model_object> <- aov(<response_column> ~ <explanatory_column>,
data = <variable_name>)
<function_for_examining_output>(<model_object>)
```
```{r ex1-hint-1}
# The response column is thorax and the exploratory column is thorax
```
```{r ex1-hint-2}
# Name the model object exercise1!
```
```{r ex1-hint-3}
# To examine the output of your model, use the summary() function!
```
::: exercise
**1-way ANOVA**: Using ANOVA, test if fruit fly longevity is affected by size (as measured by thorax length).
* What are your null and alternate hypotheses?
* What can you conclude from these results?
Create a model variable called `exercise1` and use the `summary()` function to examine the output.
**Note: Hints will be provided for exercises but no solution. Try to figure it out!**
```{r ex1, exercise = TRUE}
<model_object> <- aov(<response_column> ~ <explanatory_column>,
data = <variable_name>)
<function_for_examining_output>(<model_object>)
```
```{r ex1-hint-1}
# The response variable is longevity, and the explanatory variable is thorax.
```
```{r ex1-hint-2}
# Name the model object exercise1!
```
```{r ex1-hint-3}
# To examine the output of your model, use the summary() function!
```
:::

I just pushed the necessary style.css to use the exercise <div> as demonstrated here.

The code chunk above does not work. Please fix.

@stephan-koenig
Copy link
Member

Forgot to mention: I added a few new commits to this branch, please git pull before adding any new commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants