Introduction: Duration of mechanical ventilation is associated with adverse outcomes in critically ill patients. The increasing complexity of medication regimens has been associated with increased mortality, length of stay, and fluid overload but has never been studied in the setting of mechanical ventilation. As medication regimen complexity has also been associated with critical care pharmacist interventions, potential exists that guiding pharmacist intervention towards patients at highest risk of prolonged intubation may improve outcomes. The purpose of this analysis was to develop prediction models for mechanical ventilation duration to test the hypothesis that increasing medication regimen complexity is associated with increased duration of mechanical ventilation. Methods: In this single-center, retrospective cohort study of 354 adults managed in the intensive care unit (ICU), predictors of prolonged duration of mechanical ventilation (defined as > 5 days) were assessed. Patients were split into training (301, 85%) and testing (53, 15%) datasets. Multiple imputations were used for missing variables. Random forest was used for prediction including the variables age, sex, admission diagnosis, illness severity, and MRC-ICU. Variables with the highest importance from the random forest were selected to complementarily fit a logistic regression for better interpretation. Results: Upon random forest, medication regimen complexity was associated with prolonged mechanical ventilation. The random forest model yielded an accuracy of 0.925 (95%CI: 0.818-0.979). Upon area under the receiver operating characteristic (AUROC) analysis, the model incorporating MRC-ICU and CAM-ICU showed an AUC of 0.919 (95%CI: 0.831-1.000) for predicting whether the duration of mechanical ventilation beyond 5 days or not. Complementary logistic regression showed that the proportion of CAM-ICU positive days before intubation positively impacted the prolonged intubation duration (P < 0.100). Conclusions: The addition of medication related variables has the potential to improve prediction models and may provide specific insights into how pharmacotherapy affects patient outcomes, which has ramifications for identifying high-risk patients for pharmacist intervention.