From 5044971cc3b348d1d8c8f975271e47a0a03fa899 Mon Sep 17 00:00:00 2001 From: Julian Lange <32773007+langejulian@users.noreply.github.com> Date: Mon, 9 Sep 2024 02:45:48 +0200 Subject: [PATCH] Update multiple pages (some more minor changes) (#15) * 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) --- README.md | 2 +- index.qmd | 2 +- tutorial_pages/check-alpha.qmd | 6 +++--- tutorial_pages/check-power.qmd | 5 ++--- tutorial_pages/dry-rule.qmd | 1 - tutorial_pages/random-numbers-generators.qmd | 2 +- tutorial_pages/real-life-example.qmd | 2 -- tutorial_pages/repeat.qmd | 4 +--- 8 files changed, 9 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 8a57dd5..10baf28 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/index.qmd b/index.qmd index 8a57dd5..10baf28 100644 --- a/index.qmd +++ b/index.qmd @@ -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. diff --git a/tutorial_pages/check-alpha.qmd b/tutorial_pages/check-alpha.qmd index 9989ede..2735ec7 100644 --- a/tutorial_pages/check-alpha.qmd +++ b/tutorial_pages/check-alpha.qmd @@ -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. diff --git a/tutorial_pages/check-power.qmd b/tutorial_pages/check-power.qmd index eb3bf1c..bb679f1 100644 --- a/tutorial_pages/check-power.qmd +++ b/tutorial_pages/check-power.qmd @@ -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. diff --git a/tutorial_pages/dry-rule.qmd b/tutorial_pages/dry-rule.qmd index cba00d0..86e5e1d 100644 --- a/tutorial_pages/dry-rule.qmd +++ b/tutorial_pages/dry-rule.qmd @@ -2,7 +2,6 @@ ## *vs.* **W**rite **E**verything **T**wice – WET rule -
Following the WET rule: * Makes changes more difficult and/or time consuming. diff --git a/tutorial_pages/random-numbers-generators.qmd b/tutorial_pages/random-numbers-generators.qmd index c7f87fe..c56af89 100644 --- a/tutorial_pages/random-numbers-generators.qmd +++ b/tutorial_pages/random-numbers-generators.qmd @@ -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. *** diff --git a/tutorial_pages/real-life-example.qmd b/tutorial_pages/real-life-example.qmd index 588b249..9ec01fd 100644 --- a/tutorial_pages/real-life-example.qmd +++ b/tutorial_pages/real-life-example.qmd @@ -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). -
- This walkthrough will use the steps as defined on the page '[General structure](./general-structure.qmd)'. diff --git a/tutorial_pages/repeat.qmd b/tutorial_pages/repeat.qmd index c6489fd..9ee2d3f 100644 --- a/tutorial_pages/repeat.qmd +++ b/tutorial_pages/repeat.qmd @@ -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.'