\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{mu.strat.true}\hlkwb{<-}\hlkwd{matrix}\hlstd{(}\hlnum{0}\hlstd{,}\hlkwc{ncol}\hlstd{=nstrata,}\hlkwc{nrow}\hlstd{=}\hlnum{3}\hlstd{)}
\hlkwa{for}\hlstd{(j} \hlkwa{in} \hlnum{1}\hlopt{:}\hlstd{nstrata)\{}
    \hlstd{mu.strat.true[}\hlnum{1}\hlstd{,j]}\hlkwb{<-}\hlkwd{mean}\hlstd{(Y[Z}\hlopt{==}\hlnum{0} \hlopt{&} \hlstd{ps.strat.true} \hlopt{==} \hlstd{j])}
    \hlstd{mu.strat.true[}\hlnum{2}\hlstd{,j]}\hlkwb{<-}\hlkwd{mean}\hlstd{(Y[Z}\hlopt{==}\hlnum{1} \hlopt{&} \hlstd{ps.strat.true} \hlopt{==} \hlstd{j])}
    \hlstd{mu.strat.true[}\hlnum{3}\hlstd{,j]}\hlkwb{<-}\hlstd{mu.strat.true[}\hlnum{2}\hlstd{,j]}\hlopt{-}\hlstd{mu.strat.true[}\hlnum{1}\hlstd{,j]}
\hlstd{\}}
\hlstd{mu.strat.true}
\end{alltt}
\begin{verbatim}
+           [,1]      [,2]      [,3]      [,4]       [,5]
+ [1,]  3.918955  4.234434  4.446315  4.682338  4.9721481
+ [2,]  1.293308  1.929582  2.512729  2.960797  3.9994921
+ [3,] -2.625647 -2.304852 -1.933586 -1.721540 -0.9726559
\end{verbatim}
\end{kframe}
\end{knitrout}