Early detection of depression in young and elderly people