Automatic identification of activity–rest periods based on actigraphy