This commit is contained in:
Benedikt Ehinger
2023-10-09 16:40:53 +02:00
13 changed files with 634 additions and 162 deletions

View File

@@ -3,6 +3,22 @@
2. Add your `statistic.jl` & "include" it.
3. Export all functions
4. Create a new environment in a separate folder and add the package.
5. Does `using MyStatsPackage` work now? :tada: congratulations!
6. Go back to your package environment. Now add a dependency (e.g. ProgressMeter) and a `compat`-entry
7. Go back to your project environment, has the dependency been updated? Think: should you use `resolve` or `instantiate`?
5. Does `using MyStatsPackage` work now?
:::{.callout collapse=true}
## Yes!
:tada: congratulations!
:::
:::{.callout collapse=true}
## No!
Oh no, better check you activated the right environment - ask for help!
:::
6. Go back to your package environment. Now add a dependency (e.g. ProgressMeter.jl) and a `compat`-entry
7. Go back to your project environment, has the
dependency been updated?
:::{.callout collapse=true}
## Hint?
Should you use `resolve` or `instantiate`?
:::

View File

@@ -10,13 +10,13 @@ You can mark some code and execute it using `ctrl` + `enter` - you can also gene
## The exercise
1. Open a new script `statistic_functions.jl` in VSCode in a folder of your choice.
2. implement a function called `rse_sum`^[rse = research software engineering, we could use `sum` in a principled way, but it requires some knowledge you likely don't have right now]. This function should return `true` if provided with the following test: `res_sum(1:36) == 666`. You should further make use of a for-loop.
2. implement a function called `rse_sum`^[rse = research software engineering, we could use `sum` in a principled way, but it requires some knowledge you likely don't have right now]. This function should return `true` if provided with the following test: `rse_sum(1:36) == 666`. You should further make use of a for-loop.
3. implement a second function called `rse_mean`, which calculates the mean of the provided vector. Make sure to use the `rse_sum` function! Test it using `res_mean(-15:17) == 1`
3. implement a second function called `rse_mean`, which calculates the mean of the provided vector. Make sure to use the `rse_sum` function! Test it using `rse_mean(-15:17) == 1`
4. Next implement a standard deviation function `rse_std`: $\sqrt{\frac{\sum(x-mean(x))}{n-1}}$, this time you should use elementwise/broadcasting operators. Test it with `rse_std(1:3) == 1`
4. Next implement a standard deviation function `rse_std`: $\sqrt{\frac{\sum((x-mean(x))^2)}{n-1}}$, this time you should use elementwise/broadcasting operators. Test it with `rse_std(1:3) == 1.`
5. Finally, we will implement `rse_tstat`, returning the t-value with `length(x)-1` DF, that the provided Array actually has a mean of 0. Test it with `rse_tstat(2:3) == 5`. Add the keyword argument `σ` that allows the user to optionally provide a pre-calculated standard deviation.
5. Finally, we will implement `rse_tstat`, returning the t-value with `length(x)-1` DF, that the provided Array actually has a mean of 0. The formula is $\frac{mean(x)}{std(x) / (sqrt(length(x)))}$ Test it with `rse_tstat(2:3) == 5.`. Add the keyword argument `σ` that allows the user to optionally provide a pre-calculated standard deviation.
Well done! You now have all functions defined with which we will continue our journey.

View File

@@ -2,6 +2,9 @@
format:
revealjs:
output-file: rse_basics_slides_revealjs.html
scrollable: true
progress: true
history: false
html: default
---