This just writes new values into M as if it were an output variable. Internal function used within estimate_m_rd.
estimate_m_rd
gibbsM(M, num_cats, X, Y, R, pri)