These files are diagrams, procedures, and code in R and Stata implementing the analysis in the paper "Medication gaps and antipsychotic polypharmacy in previously hospitalized schizophrenia patients: an electronic cohort study in three Canadian provinces."