-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
49 lines (36 loc) · 2.11 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# Power analysis for personal light exposure measurements and interventions
<!-- badges: start -->
<!-- badges: end -->
This repository contains the code for the publication "Power analysis for personal light exposure measurements and interventions" by Zauner, Udovicic, and Spitschan (2024). The code is written in the R software and uses [Quarto](https://quarto.org) for rendering.
In the script, we use light exposure data from shift workers during day shifts to calculate statistical power of changes in light exposure metrics between seasons.
To reproduce the anaylsis, R and Quarto have to be installed. The code is found in `PowerCalc.qmd`. The rendered version of the code can also be found in the file `PowerCalc.html`.
The folder `Data` contains the raw data files used in the analysis, as well as an `Overview.xls` file that contains the shift schedule of the participants.
The folder `Figures` contains the figures generated by the code. They are named after the figures in the manuscript.
The folder `Results` contains a csv file with the results of the power analysis depending on sample size and metric. Running the script with 1000 resamples for sample sizes between 3 and 50 for 12 metrics takes about 2-3 hours on an M1 Max MacbookPro (adding up to 576,000 resamples/tests). If you uncomment line `717` in the code, and comment out the rest of the `statistics` chunk as well as the `bootstrapping` chunk, most of the computation time can be stripped.
Most important parameters are found in the YAML:
```
---
#other YAML parts
...
params:
Power_level: 0.8
sign_level: 0.05
valid_data_threshold: 0.8
n_samples: 1000
sample_size_min: 3
sample_size_max: 50
seed: 20231212
---
```
These parameters control threshold values, the range of sample sizes, the number of resources, and the seed for the random number generator.
Of further interest might be the `Metrics` chunk and section, where the metrics are chosen and calculated.