Abstract
<p>Clustered data are common in psychological studies that collect repeated observations from individuals, classrooms, clinics, or other naturally occurring units. Such data offer rich opportunities for predicting psychological outcomes, but they also pose substantial analytic challenges. Predictors are usually high-dimensional, and the relations between independent and dependent within-level variables may vary across between-level clusters. Traditional statistical models are often restrictive under these conditions, whereas many supervised machine-learning models assume common predictive relations across clusters. To address these limitations, we developed a multilevel deep-learning framework for clustered data. The framework separates stable between-cluster differences from within-cluster deviations while allowing between-level variables to shape how within-level data is processed. It includes three components: (a) a baseline network that predicts each cluster’s typical outcome level from between-level variables, (b) a deviation network that predicts within-level deviations from that baseline using within-level variables, and (c) a slope network that maps between-level variables onto individualized slope vectors that gate within-level variables. We validated the framework using a digital-sensing and experience-sampling dataset and compared its performance against previous state-of-the-art models. The validation sample comprised 483 participants (219 female; Mage = 42.98 years, SD = 12.84), contributing a total of 6,737 days of data. Predictors included 560 daily smartphone-sensing (within-level) variables and 37 person-level (between-level) variables, and the outcome was daily affect. The proposed framework outperformed existing models and provided multiple layers of interpretive opportunities. The framework offers an innovative approach for combining between-level and within-level data in personalized psychological prediction models.</p>