BackgroundGiven the heterogeneity of stroke, it is important to determine the best course of motor therapy for each patient, i.e., to personalize rehabilitation based on predictions of long-term outcomes. Here, we propose a hierarchical Bayesian dynamic (i.e., state-space) model (HBDM) to forecast long-term changes in a motor outcome due to rehabilitation in the chronic phase post-stroke.MethodsThe model incorporates the effects of clinician-supervised training, self-training, and forgetting. In addition, to improve forecasting early in rehabilitation, when data are sparse or unavailable, we use the Bayesian hierarchical modeling technique to incorporate prior information from similar patients. We use HBDM to re-analyze the Motor Activity Log (MAL) data of participants with chronic stroke included in two clinical trials: (1) the DOSE trial, in which participants were assigned to a 0, 15, 30, or 60-h dose condition (data of 40 participants analyzed), and (2) the EXCITE trial, in which participants were assigned a 60-h dose, in either an immediate or a delayed condition (95 participants analyzed).ResultsFor both datasets, HBDM accounts well for individual dynamics in the MAL during and outside of training: mean RMSE = 0.28 for all 40 DOSE participants (participant-level RMSE 0.26 ± 0.19—95% CI) and mean RMSE = 0.325 for all 95 EXCITE participants (participant-level RMSE 0.32 ± 0.31), which are small compared to the 0-5 range of the MAL. Bayesian leave-one-out cross-validation shows that the model has better predictive accuracy than static regression models and simpler dynamic models that do not account for the effect of supervised training, self-training, or forgetting. We then showcase model’s ability to forecast the MAL of “new” participants up to 8 months ahead. The mean RMSE at 6 months post-training was 1.36 using only the baseline MAL and then decreased to 0.91, 0.79, and 0.69 (respectively) with the MAL following the 1st, 2nd, and 3rd bouts of training. In addition, hierarchical modeling improves prediction for a patient early in training. Finally, we verify that this model, despite its simplicity, can reproduce previous findings of the DOSE trial on the efficiency, efficacy, and retention of motor therapy.ConclusionsIn future work, such forecasting models can be used to simulate different stages of recovery, dosages, and training schedules to optimize rehabilitation for each person.Trial registrationThis study contains a re-analysis of data from the DOSE clinical trial ID NCT01749358 and the EXCITE clinical trial ID NCT00057018Supplementary InformationThe online version contains supplementary material available at 10.1186/s12984-023-01202-y.