typesetting 2 line conditions over which is summed

This is possible also with standard LaTeX methods, but in this case a direct approach with TeX primitives is handier

\documentclass{article}
\usepackage{amsmath}

\newcommand\mycomplicatedsubscript{
  j\colon
  \vcenter{
    \offinterlineskip
    \halign{
      \hfil$\scriptscriptstyle##$&$\scriptscriptstyle##$\hfil\cr
      \mathstrut m_j&=m_i\cr\noalign{\kern1pt}
      z_j&=z_i\cr
  }}
}

\begin{document}

\[
  y=\sum_i\frac{\biggl(1-\dfrac{1}{\sum_{\mycomplicatedsubscript}f(m(j),z(j),s(j))}\biggr)^2}{1}
\]
\end{document}

Notice the use of \dfrac and of \biggl and \biggr rather than \left and \right that would unbalance the parentheses, because the denominator is much taller than the numerator. enter image description here


You may also want to consider using the subarray environment provided by the amsmath package.

In the MWE below, the first equation uses this environment to typeset the "inner" formula of your example. The second equation, which places this inner formula into the full expression, looks cramped because, by TeX's rules, the contents of the inner formula are all set in scriptscriptstyle/scriptstyle. At the same time, the parentheses that surround the numerator are over-sized because they use \left and \right directives. Relative to the second equation, the third equation uses (i) the \dfrac command to restore the overall look of the inner formula, (ii) a pair of \bigl( and \bigr) parentheses to help distinguish visually among the plethora of parentheses, (iii) a pair of \Biggl( and \Biggr) directives to surround the numerator, and (iv) the \mathlarger command (which is provided by the relsize package) to increase the size of the outer summation sign.

\documentclass{article}
\usepackage{amsmath,relsize}
\begin{document}
\begin{gather*}
\sum\nolimits_{j:\, 
         \begin{subarray}{c}
           m_j=m_i \\ z_j=z_i
         \end{subarray}}
    f(m(j),z(j),s(j)) \\
y = \sum_i \frac{\left( 1-\frac{1}{
    \sum\nolimits_{j:\, 
         \begin{subarray}{c}
            m_j=m_i \\ z_j=z_i
         \end{subarray}}
    f(m(j),z(j),s(j))}\right)^2}{i}\\
y = \mathlarger{\sum}_i \frac{\Biggl( 1-\dfrac{1}{
    \sum\nolimits_{j: \,
         \begin{subarray}{c}
            m_j=m_i \\ z_j=z_i
         \end{subarray}}
    f\bigl(m(j),z(j),s(j)\bigr)}\Biggr)^2}{i}
\end{gather*}
\end{document}

enter image description here