Human Activity Recognition (HAR) is a powerful tool for understanding human behaviour. Pervasive sensors, such as wearable devices, have an increasing market penetration and generate a tremendous amount of data. The myriad of available clinical and consumer-grade wearables generate a continuous time series of a person's daily physical exertion and rest. Applying HAR to the activity time series can provide new insights by enriching the feature set in health studies, and enhancing the personalisation and effectiveness of health, wellness, and fitness applications. The analyses of complex health behaviours such as sleep, traditionally require a time-consuming manual interpretation by experts. This manual work is necessary due to the erratic periodicity and persistent noisiness of human behaviour. In this paper, we present a robust automated human activity recognition algorithm, which we call RAHAR. We test our algorithm in the application area of sleep research by providing a novel framework for evaluating sleep quality and examining the correlation between the aforementioned and an individual's physical activity. Our results improve the state-of-The-Art procedure in sleep research by 15% for area under ROC and by 30% for F1 score on average. However, application of RAHAR is not limited to sleep analysis and can be used for understanding other health problems such as obesity, diabetes, and cardiac diseases.