Skip to content

Commit

Permalink
Update multiple pages (some more minor changes) (#15)
Browse files Browse the repository at this point in the history
* Update check-alpha.qmd (format R output as block quote instead of line block)

* Update check-power.qmd (formatting of numbered exercise list)

* Update repeat.qmd (rm bullet point breaking up a sentence)

* Update real-life-example.qmd (rm empty space)

* Update README.md and index.qmd (capitalize "Dry" in tutorial overview)

* Update random-numbers-generators.qmd (reword task to use actual file names instead of referring to non-existent file)

* Update dry-rule.qmd (rm empty space)
  • Loading branch information
langejulian committed Sep 9, 2024
1 parent 2439044 commit 5044971
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ It is necessary that you work through the sections of the tutorial in order. Ple
* [Setting the seed](./tutorial_pages/seed.qmd) – How can you generate the same random numbers?
* [Sample size `n`](./tutorial_pages/sample-size-n.qmd) – How many values should you generate within a simulation?
* [Number of simulations `nrep`](./tutorial_pages/number-of-simulations-nrep.qmd) – How many repeats of a simulation should you run?
* [Dry rule](./tutorial_pages/dry-rule.qmd) – How to write your own functions?
* [DRY rule](./tutorial_pages/dry-rule.qmd) – How to write your own functions?
* [Simulate to check alpha](./tutorial_pages/check-alpha.qmd) – Write your first simulation and check the rate of false-positive findings.
* [Simulate to check power](./tutorial_pages/check-power.qmd) – Simulate data to perform a power analysis.
* [Simulate to prepare a preregistration](./tutorial_pages/simulate-for-preregistration.qmd) – Simulate data to test statistical analyses before preregistering them.
Expand Down
2 changes: 1 addition & 1 deletion index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ It is necessary that you work through the sections of the tutorial in order. Ple
* [Setting the seed](./tutorial_pages/seed.qmd) – How can you generate the same random numbers?
* [Sample size `n`](./tutorial_pages/sample-size-n.qmd) – How many values should you generate within a simulation?
* [Number of simulations `nrep`](./tutorial_pages/number-of-simulations-nrep.qmd) – How many repeats of a simulation should you run?
* [Dry rule](./tutorial_pages/dry-rule.qmd) – How to write your own functions?
* [DRY rule](./tutorial_pages/dry-rule.qmd) – How to write your own functions?
* [Simulate to check alpha](./tutorial_pages/check-alpha.qmd) – Write your first simulation and check the rate of false-positive findings.
* [Simulate to check power](./tutorial_pages/check-power.qmd) – Simulate data to perform a power analysis.
* [Simulate to prepare a preregistration](./tutorial_pages/simulate-for-preregistration.qmd) – Simulate data to test statistical analyses before preregistering them.
Expand Down
6 changes: 3 additions & 3 deletions tutorial_pages/check-alpha.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ These proportions are not significantly different from 5%.
prop.test(45, 1000, p = 0.05, alternative = "two.sided", correct = TRUE)
```

| 1-sample proportions test with continuity correction
| data: 45 out of 1000, null probability 0.05
| X-squared = 0.42632, df = 1, p-value = 0.5138
> 1-sample proportions test with continuity correction
> data: 45 out of 1000, null probability 0.05
> X-squared = 0.42632, df = 1, p-value = 0.5138
It is important to note that, although `alpha = 0.05` is commonly used, this is an arbitrary choice and you should consider what is an appropriate type 1 error rate for your particular investigation.

Expand Down
5 changes: 2 additions & 3 deletions tutorial_pages/check-power.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ If we sample values from two normal distributions with different means (e.g. N(0
**YOUR TURN:**
1. Use your simulation skills to work out the power through simulation.
Write a function that does the following:

i) Draws `n` values from a random normal distribution with `mean1` and another `n` values from a normal distribution with `mean2`.
ii) Compares the means of these two samples with a *t*-test and extracts the *p*-value.
i) Draws `n` values from a random normal distribution with `mean1` and another `n` values from a normal distribution with `mean2`.
ii) Compares the means of these two samples with a *t*-test and extracts the *p*-value.
2. Replicate the function 1000 times using the parameters used in the power calculation above (that used the `power.t.test()` function).
3. Calculate the proportion of *p*-values that are smaller than 0.05.

Expand Down
1 change: 0 additions & 1 deletion tutorial_pages/dry-rule.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

## *vs.* **W**rite **E**verything **T**wice – WET rule

<br/>
Following the WET rule:

* Makes changes more difficult and/or time consuming.
Expand Down
2 changes: 1 addition & 1 deletion tutorial_pages/random-numbers-generators.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Sampling without replacement means that when you repeatedly draw e.g. one item a

***
**YOUR TURN:**
Sample 100 values between 3 and 103 with replacement. For this, open the file `./exercise_script.R` from the root of your local repository (with or without answers), review the examples if needed, complete the exercise, and check out the proposed answer.
Sample 100 values between 3 and 103 with replacement. For this, open the R script(s) with the exercises (`./exercise_script_with_solutions.R` and/or `./exercise_script_without_solutions.R`) from the root of your local repository, review the examples if needed, complete the exercise, and check out the proposed answer.

***

Expand Down
2 changes: 0 additions & 2 deletions tutorial_pages/real-life-example.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ I created this code while preparing my preregistration for a simple behavioural

The R script screenshot below, `glm_Freq_vs_YN.R`, can be found in the folder [Ihle2020](https://github.com/lmu-osc/Introduction-Simulations-in-R/tree/main/Ihle2020).

<br/>

This walkthrough will use the steps as defined on the page '[General structure](./general-structure.qmd)'.


Expand Down
4 changes: 1 addition & 3 deletions tutorial_pages/repeat.qmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Repetition

The function

* `replicate(nrep, expression)` repeats the `expression` provided `nrep` times.
The function `replicate(nrep, expression)` repeats the `expression` provided `nrep` times.

For example, `replicate(10, mean(rnorm(100)))` reads: 'Draw 100 values from a normal distribution with a mean of 0 and a standard deviation of 1 (the default values of `rnorm(n, mean, sd)`), calculate the mean of these 100 values, and do all that 10 times.'

Expand Down

0 comments on commit 5044971

Please sign in to comment.