mata: for (k = 1; k<=`h'-1 ; k++) { gamma_s = J(`h'-1,1,.) gamma_k = (1/`T')*((d[215+k+1::588]-dbar)'*(d[216::588-k])-dbar) gamma_s[k,1] = gamma_k gamma = st_numscalar("g_0") + 2*sum(gamma_s) }