Automated Actigraphy Analysis and Preprocessing in R
This page is an information and support page for the ACTman R-package. The corresponding GitHub page can be found here.
The ACTman package will be installed from Github, using the devtools( ) R-package. Use the following code to first install devtools() and subsequently ACTman():
install.packages("devtools", dep = TRUE) library("devtools") devtools::install_github("compsy/actman") library("ACTman")
As an example, we will run ACTman with 3 actigraphy datasets and perform both circadian rhythm and sleep analyses.
First, download the three datasets which are available as a .zip file here. Make sure you save and unzip the datasets in a folder that is easy to find, e.g. “C:\mydata”.
You can now run the following two bits of R code to perform respectively the circadian rhythm analysis and the sleep analysis:
# Circadian Rhythm analysis: ACTman::ACTman(workdir = "C:/mydata", myACTdevice = "MW8", lengthcheck = FALSE) # Sleep analysis: ACTman::ACTman(workdir = "C:/mydata", myACTdevice = "MW8", iwantsleepanalysis = TRUE, circadian_analysis = FALSE, Lengthcheck = FALSE)
ACTman will create a new folder called “Results” in your working directory (e.g. “C:/mydata/Results”) to store the calculated results in .CSV format.
If the analyses ran correctly, you will find an overview file (called “ACTdata_overview.csv”), which provides information on the following variables:
- Start of dataset
- Original end of dataset (end)
- New end of dataset ((optional); end2; e.g. after custom period selection)
- Original number of epochs
- New number of epochs (optional)
- Original recording time in days
- New recording time in days (optional)
- Whether a date on which summertime starts is included in the dataset
- Whether a date on which summertime ends is included in the dataset
- Number of missing data points
- Percentage of missing data points
- Circadian rhythm analysis output (optional)
- Whether the last 5 epochs included any activity at all
- Whether data were automatically pruned to 14 full consecutive days (optional)
Then, depending on the type of analysis you performed, you will find a file with the Circadian Rhythm analysis output (“ACTdata_circadian_res.csv”) and / or the Sleep analysis output (“sleepdatax.csv”).
In the Circadian Rhythm analysis output, you will find the following non-parametric output variables:
- Interdaily Stability (IS)
- Intradaily Variability (IV)
- Relative Amplitude (RA)
- L5 (avarage activity during the 5 least active hours)
- Start time of the L5 period
- M10 (avarage activity during the 10 most active hours)
- Start time of the M10 period
In the Sleep analysis output, you will find the following sleep output variables:
- Time of Sleep onset
- Time of sleep end
- Sleep efficiency
- Sleep latency
- Time of going to bed as reported in the sleep-diary
- Time of getting out of bed as reported in the sleep-diary
- Time in bed
- Assumed sleep
- Duration of wake epochs
- Duration of actual sleep
- Percentage of actual sleep
- Duration of actual wake
- Percentage of actual wake
raw MotionWatch 8 files (.mtn) will first have to be converted into .csv before processing them further in ACTman.
Converting can be done easily, by clicking in the main MotionWare screen on Bulk export/Choose file and after the file is selected, on Export to CSV Now.
Now the data is ready for further (bulk)-processing in the ACTman package.