def prior_contribution_coefficients(self, state):
""" Calculate prior contribution from regression coefficients.
Log scale.
"""
# This will need to be revised if we allow different
# variances for different classes of coefficients, eg
# microbiome related and host-covariate related
dimensions = len(state.beta)
normalization = -0.5*dimensions*(
np.log(2.0*np.pi*self.prior_coefficient_variance)
)
exponent = (-0.5*np.dot(state.beta, state.beta) /
(self.prior_coefficient_variance))
return normalization + exponent
评论列表
文章目录