How age and dementia affect sleep detection