Depression is a highly prevalent condition characterized by persistent low mood, energy, and activity that can affect one's thoughts, mood, behavior, and sense of well-being. Repetitive transcranial magnetic stimulation (rTMS), a non-invasive neuromodulatory technique, is an effective treatment for depression. However, remission rates are suboptimal and ideal stimulation parameters are unknown. The overarching goal of this study is to elucidate how brain changes accumulate during rTMS, and how these changes relate to clinical outcome. I plan to recruit patients with medication-resistant depression and treat with four weeks of rTMS in a randomized, double-blind, sham-controlled fashion. I will measure brain changes using TMS-EEG and determine how these changes relate to clinical outcome. This study will 1) test how brain changes relate to clinical outcome and 2) establish a computational model to help predict outcome and propose novel treatment protocols.