add functions to support computing logZ, save the logZ, and the model coefficients