/ZaunerEtAl_PLoS_ONE_2024

Code and analysis results for the publication on power analysis for light logger data

Primary LanguageHTMLMIT LicenseMIT

Power analysis for personal light exposure measurements and interventions

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 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.