\documentclass[../Main.tex]{subfiles}
\graphicspath{{\subfix{Assets/img/}}}

\begin{document}
Derivations related to the marginal survival rate analysis.

\begin{align*}
    \parder{R_i}{s^i_t}{} =&  -\left(\parder{l^i}{s^i_t}{} + \parder{l^i}{S_t}{}\parder{S_t}{s^i_t}{} \right) 
        =  - \parder{l^i}{s^i_t}{} - \parder{l^i}{S_t}{}  \\
    \parder{R}{s^i_t}{} =& \frac{S_t \sum_{i=1}^N 
        \left(  [1-l^i(s^i_t,S_t,D_t)] + s^i_t [ -\parder{l^i}{s^i_t}{} -\parder{l^i}{S_t}{}\parder{S_t}{s^i_t}{}] \right) 
        - \left( \sum_{i=1}^N s^i_t[1-l^i(s^i_t,S_t,D_t)] \right)}{(S_t)^2} \\
    =& \sum_{i=1}^N \left[ \frac{S_t [1-l^i(s^i_t,S_t,D_t)]}{(S_t)^2}
        - \frac{ s^i_t[1-l^i(s^i_t,S_t,D_t)] }{(S_t)^2} \right] 
            +\sum_{i=1}^N \frac{ s^i_t S_t [ -\parder{l^i}{s^i_t}{} - \parder{l^i}{S_t}{}] }{(S_t)^2} \\
    =& \sum_{i=1}^N \left[ \frac{S_t - s^i_t}{(S_t)^2}[1-l^i(s^i_t,S_t,D_t)]  \right]
            +\sum_{i=1}^N \frac{ s^i_t}{ S_t} \parder{R_i}{s^i_t}{} \\
    =& \sum_{i=1}^N \left[ \frac{1}{S_t}[1-l^i(s^i_t,S_t,D_t)]  \right] - \frac{R}{S_t}
            +\sum_{i=1}^N \frac{ s^i_t}{ S_t} \parder{R_i}{s^i_t}{} \\
    =& \sum_{i=1}^N \left[ \frac{R_i}{S_t} \right] - \frac{R}{S_t}
            +\sum_{i=1}^N \frac{ s^i_t}{ S_t} \parder{R_i}{s^i_t}{} 
\end{align*}

\end{document}
