def lnlike(self, pars):
# Pull theta out of pars
theta = pars[:self.Nbins]
# Generate the inner summation
gamma = np.ones_like(self.bin_idx) * np.nan
good = (self.bin_idx < self.Nbins) & (self.bin_idx >= 0) # nans in q get put in nonexistent bins
gamma[good] = self.Nobs * self.censoring_fcn(self.mcmc_samples[good]) * theta[self.bin_idx[good]]
summation = np.nanmean(gamma, axis=1)
# Calculate the integral
I = self._integral_fcn(theta)
# Generate the log-likelihood
ll = -I + np.nansum(np.log(summation))
return ll
评论列表
文章目录