Stacked Generalization Model for Predicting Happiness: Positive Affect, Gratitude, Social Connectedness, and Psychological Flexibility

Authors

    Merve Okan Department of Psychology, University of Toronto, Toronto, Canada
    Cheng-Xiong Lu * Mac Anxiety Research Centre, McMaster University, Suite L02, Hamilton, ON, Canada cheng-xiong-lu@mcmaster.ca
    Laura Ros-García Department of Social Psychology, Social Work, Social Services, and Social Anthropology Faculty of Psychology, University of Málaga, 29071 Málaga, Spain
    Wilmer Antonio Hernandez Department of Social Psychology, School of Psychology, University of Sevilla, C / Camilo José Cela, s / n 41018 Seville, Spain

Keywords:

Happiness, Stacked Generalization, Positive Affect, Gratitude, Social Connectedness, Psychological Flexibility

Abstract

Objective: The present study aimed to develop and evaluate a stacked generalization machine learning model to predict happiness based on positive affect, gratitude, social connectedness, and psychological flexibility.

Methods and Materials: This cross-sectional predictive study was conducted on a sample of 742 adults recruited from Canada using stratified online sampling to ensure demographic diversity. Participants completed validated self-report instruments including the Subjective Happiness Scale (SHS), the Positive Affect subscale of the Positive and Negative Affect Schedule (PANAS), the Gratitude Questionnaire-6 (GQ-6), the Social Connectedness Scale-Revised (SCS-R), and the Acceptance and Action Questionnaire-II (AAQ-II). Data preprocessing involved handling missing values via multiple imputation, outlier adjustment using robust scaling, and feature standardization. The dataset was split into training (80%) and testing (20%) sets, and model training utilized 10-fold cross-validation. A stacked generalization model was constructed using base learners including linear regression, support vector regression, random forest, and gradient boosting, with a Ridge regression meta-learner. Model performance was evaluated using mean squared error (MSE), root mean squared error (RMSE), and coefficient of determination (R²), and interpretability was enhanced באמצעות SHapley Additive exPlanations (SHAP) analysis.

Findings: The stacked generalization model demonstrated superior predictive performance compared to all base models, achieving the highest explained variance (R² = 0.74) and the lowest prediction error (RMSE = 0.52). Among the predictors, positive affect exhibited the strongest contribution to happiness, followed by social connectedness, gratitude, and psychological flexibility. SHAP analysis revealed significant nonlinear and interaction effects among predictors, indicating that the combined influence of these variables enhances predictive accuracy beyond additive models.

Conclusion: The findings highlight the effectiveness of stacked generalization in modeling complex psychological constructs and underscore the central role of positive affect, gratitude, social connectedness, and psychological flexibility in predicting happiness, supporting the integration of machine learning approaches in psychological research and intervention design.

Downloads

Download data is not yet available.

References

Armenta, C. N., Fritz, M. M., Walsh, L. C., & Lyubomirsky, S. (2022). Satisfied Yet Striving: Gratitude Fosters Life Satisfaction and Improvement Motivation in Youth. Emotion, 22(5), 1004-1016. https://doi.org/10.1037/emo0000896

Arnstein, K. B., Desmet, O. A., Seward, K., Traynor, A., & Olenchak, F. R. (2023). Underrepresented Students in Gifted and Talented Education: Using Positive Psychology to Identify and Serve. Education Sciences, 13(9), 955. https://doi.org/10.3390/educsci13090955

Asghar, M., Minichiello, A., & Iqbal, A. (2022). Perceived Factors Contributing to the Subjective Wellbeing of Undergraduate Engineering Students: An Exploratory Study. International journal of environmental research and public health, 19(23), 16284. https://doi.org/10.3390/ijerph192316284

Bhatt, K., & Weissman, C. R. (2024). The Effect of Psilocybin on Empathy and Prosocial Behavior: A Proposed Mechanism for Enduring Antidepressant Effects. NPJ Mental Health Research, 3(1). https://doi.org/10.1038/s44184-023-00053-8

Chen, L., Liu, J., Fu, L., Guo, C., & Chen, Y. (2022). The Impact of Gratitude on Connection With Nature: The Mediating Role of Positive Emotions of Self-Transcendence. Frontiers in psychology, 13. https://doi.org/10.3389/fpsyg.2022.908138

Chhajer, R., & Hira, N. (2024). Exploring Positive Psychology Intervention and Mindfulness-Based Intervention in Nature: Impact on Well-Being of School Students in India. Frontiers in Public Health, 12. https://doi.org/10.3389/fpubh.2024.1297610

Dalal, S., & Singh, S. K. (2025). Gratitude in Action: Effect of Gratitude on Mental Health. Journal of Health Management, 27(1), 100-107. https://doi.org/10.1177/09720634241304985

Dennis, A., & Ogden, J. (2022). Nostalgia, Gratitude, or Optimism: The Impact of a Two-Week Intervention on Well-Being During COVID-19. Journal of Happiness Studies, 23(6), 2613-2634. https://doi.org/10.1007/s10902-022-00513-6

Garg, N., Mahipalan, M., Poulose, S., & Burgess, J. (2022). Does Gratitude Ensure Workplace Happiness Among University Teachers? Examining the Role of Social and Psychological Capital and Spiritual Climate. Frontiers in psychology, 13. https://doi.org/10.3389/fpsyg.2022.849412

Kesenheimer, J. S., Kastenmüller, A., Kinkel, L. S., Fidan, B., & Greitemeyer, T. (2023). When Do I Feel Good When I Am Nice? A Diary Study About the Relationship Between Prosocial Behavior and Well‐being. Journal of Applied Social Psychology, 53(9), 892-905. https://doi.org/10.1111/jasp.12975

Layous, K., Kurtz, J. L., Wildschut, T., & Sedikides, C. (2022). The Effect of a Multi-Week Nostalgia Intervention on Well-Being: Mechanisms and Moderation. Emotion, 22(8), 1952-1968. https://doi.org/10.1037/emo0000817

Liao, K. Y., & Wei, M. (2022). Intolerance of Uncertainty, Acculturative Stress, Gratitude, and Distress: A Moderated Mediation Model. The counseling psychologist, 51(2), 270-294. https://doi.org/10.1177/00110000221138803

Mahasneh, A. M. (2022). The Relationship Between Subjective Well-Being and Social Support Among Jordanian University Students. Psychology in Russia State of Art(2), 53-64. https://doi.org/10.11621/pir.2022.0204

Maragha, T., Garcia, A. P., Shuler, C. F., & Bergmann, H. v. (2023). The Six‐domain Well‐being Framework in Oral Health Sciences: A Pathway From Theory to Practice. Journal of Dental Education, 88(2), 157-168. https://doi.org/10.1002/jdd.13401

Merlo, G., Pereira-Sánchez, V., Lee, W., Wong, W. Y., & Morales, M. J. (2025). Connectedness as a Mental Health Pillar: To Self, Others, and the World. Psychiatric Annals, 55(7). https://doi.org/10.3928/00485713-20250613-03

Merlo, G., Snellman, L., & Sugden, S. G. (2025). Connectedness: The Updated and Expanded Pillar of Lifestyle Psychiatry and Lifestyle Medicine. American Journal of Lifestyle Medicine, 19(8), 1104-1124. https://doi.org/10.1177/15598276251345455

Nadal, C. T., Ros‐Morente, A., & Quesada‐Pallarès, C. (2024). Trait Emotional Intelligence Mediates the Dispositional Gratitude and Subjective Well-Being in Young Adults. Frontiers in psychology, 15. https://doi.org/10.3389/fpsyg.2024.1414867

Nelson, S. K., & Coffey, J. K. (2024). Gratitude Improves Parents’ Well-Being and Family Functioning. Emotion, 24(2), 357-369. https://doi.org/10.1037/emo0001283

Osborn, T. L., Brenda, Johnson, N., Venturo‐Conerly, K. E., Rusch, T., Weisz, J. R., & Wasanga, C. (2022). Depression and Anxiety Symptoms Among Kenyan Adolescents: Prevalence Rates and Associations With Socio-Demographic and Psycho-Social Factors During the COVID-19 Pandemic. https://doi.org/10.31234/osf.io/tvbpy

Regan, A., Radošić, N., & Lyubomirsky, S. (2022). Experimental Effects of Social Behavior on Well-Being. Trends in Cognitive Sciences, 26(11), 987-998. https://doi.org/10.1016/j.tics.2022.08.006

Sahar, N. u., Baranovich, D. L., & Tharbe, I. H. A. (2022). Does Gratitude Work at School? Piloting the Modified Interventions for Managing Academic Stress in Pakistani High Schools. Journal of Muslim Mental Health, 16(2). https://doi.org/10.3998/jmmh.430

Samus, A., Dickinson, K. J. M., Freeman, C., & Heezik, Y. v. (2024). How to Increase Nature Connectedness? Effectiveness and Mechanisms of a Gratitude Journal Intervention. People and Nature, 6(6), 2399-2417. https://doi.org/10.1002/pan3.10735

Tee, E. Y. J., & Raja Intan Arifah Binti Raja Reza, S. (2022). Self‐transcendent Emotions and Their Influence on Organizational Effectiveness: A Literature Review and Synthesis. Asian Journal of Social Psychology, 26(1), 146-163. https://doi.org/10.1111/ajsp.12550

Thompson, J. (2022). Enhancing Resilience: An Interpretative Phenomenological Analysis of the Awe Project. Journal of Community Safety and Well-Being, 7(3), 93-110. https://doi.org/10.35502/jcswb.265

Thompson, J. (2023). Narrative Health: Examining the Relationship Between the Phenomenon of Awe and Resilience and Well-Being. Journal of Community Safety and Well-Being, 8(2), 85-98. https://doi.org/10.35502/jcswb.321

Walsh, L. C., Regan, A., Twenge, J. M., & Lyubomirsky, S. (2022). What Is the Optimal Way to Give Thanks? Comparing the Effects of Gratitude Expressed Privately, One-to-One via Text, or Publicly on Social Media. Affective science, 4(1), 82-91. https://doi.org/10.1007/s42761-022-00150-5

Wang, L., Gonzalez, P. D., Lau, P. L., Vaughan, E. L., & Costa, M. F. (2023). “Dando Gracias”: Gratitude, Social Connectedness, and Subjective Happiness Among Bilingual Latinx College Students. Journal of Latinx Psychology, 11(3), 203-219. https://doi.org/10.1037/lat0000227

Winkelmair, A., Siebertz, M., Jost, L., Schroter, F. A., Bartenschlager, C. T. J., & Jansen, P. (2023). Explicit and Implicit Affective Attitudes Toward Sustainability: The Role of Mindfulness, Heartfulness, Connectedness to Nature and Prosocialness. International Journal of Applied Positive Psychology, 8(3), 571-598. https://doi.org/10.1007/s41042-023-00107-4

Zare, J., Delavar, K. A., & Derakhshan, A. (2023). The Impact of Altruism on the Emotions and English Summary Writing Skills of L2 Learners: An Intervention Study in Light of Positive Psychology. Language Teaching Research, 30(1), 343-364. https://doi.org/10.1177/13621688231151632

Zhang, Y., & Carciofo, R. (2021). Assessing the Wellbeing of Chinese University Students: Validation of a Chinese Version of the College Student Subjective Wellbeing Questionnaire. BMC psychology, 9(1). https://doi.org/10.1186/s40359-021-00569-8

Downloads

Additional Files

Published

2026-07-01

Submitted

2026-01-17

Revised

2026-03-29

Accepted

2026-04-08

Issue

Section

Articles

How to Cite

Okan , M. ., Lu , C.-X. ., Ros-García , L. ., & Hernandez , W. A. . (2026). Stacked Generalization Model for Predicting Happiness: Positive Affect, Gratitude, Social Connectedness, and Psychological Flexibility. Journal of Assessment and Research in Applied Counseling (JARAC), 1-10. https://journals.kmanpub.com/index.php/jarac/article/view/207