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)




Running ACTman

As an example, we will run ACTman with 2 actigraphy datasets and perform both circadian rhythm and sleep analyses.

First, download the two 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")

# Sleep analysis:
ACTman::ACTman(workdir = "C:/mydata", myACTdevice = "MW8",
iwantsleepanalysis = TRUE, circadian_analysis = FALSE)

Interpreting Results

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:

  • Filename
  • 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:

  • Date
  • 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