Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

petteriTeikari/vanSomerenPhaseEstimate

Repository files navigation

vanSomerenPhaseEstimate

MATLAB implementation of circadian phase estimation from actigraphy data, based on the method described by Van Someren and Nagtegaal (2007).

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#E8F4FD', 'primaryBorderColor': '#7BA7C9', 'primaryTextColor': '#2C3E50', 'secondaryColor': '#FDF2E9', 'secondaryBorderColor': '#D4A574', 'secondaryTextColor': '#2C3E50', 'tertiaryColor': '#EAFAF1', 'tertiaryBorderColor': '#82C9A1', 'tertiaryTextColor': '#2C3E50', 'lineColor': '#5D6D7E', 'textColor': '#2C3E50', 'background': '#FFFFFF', 'mainBkg': '#E8F4FD', 'nodeBorder': '#7BA7C9', 'clusterBkg': '#F8F9FA', 'clusterBorder': '#BDC3C7', 'fontSize': '14px'}}}%%
flowchart LR
    A[Actigraphy Data]:::input --> B[Phase Estimation Algorithm]
    B --> C[Circadian Phase]
    C --> D[Melatonin Onset Prediction]:::output

    classDef input fill:#FDF2E9,stroke:#D4A574
    classDef output fill:#EAFAF1,stroke:#82C9A1
Loading

Overview

This toolbox estimates circadian phase from wrist actigraphy recordings by fitting progressively complex cosine models to activity data. The approach enables non-invasive prediction of dim-light melatonin onset (DLMO) timing without requiring salivary or plasma melatonin sampling.

The implementation fits four cosine model variants with increasing complexity:

  • BCF -- Baseline Cosine Function
  • SBCF -- Skewed Baseline Cosine Function
  • BBCF -- Bimodal Baseline Cosine Function
  • BSBCF -- Bimodal Skewed Baseline Cosine Function

Key Features

  • Non-linear least-squares fitting with configurable bounds and initial values
  • Four cosine model variants capturing asymmetry and bimodality in activity patterns
  • Execution timing for each fit stage
  • Demo script with sample actigraphy data (testVanSomeren2007_fits.m)

Quick Start

% Load sample data
load('inputDataForCosineFitting.mat');

% Run the demo
testVanSomeren2007_fits

Citation

Van Someren EJW, Nagtegaal E (2007). Improving melatonin circadian phase estimates. Sleep Medicine 8:590--601. doi:10.1016/j.sleep.2007.03.012

License

MIT License. See LICENSE for details.

About

MATLAB implementation of circadian phase estimation from actigraphy (Van Someren & Nagtegaal, 2007, Sleep Medicine)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors