From 52589a533f2dc4c818224aad7b7a13d0aebc60cf Mon Sep 17 00:00:00 2001 From: Richard Stiskalek Date: Thu, 26 Sep 2024 11:59:50 +0200 Subject: [PATCH] Switch to Jeffrey prior (#153) * Switch to Jeffrey * Add Jeffrey priors * Bring things back --- csiborgtools/flow/flow_model.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/csiborgtools/flow/flow_model.py b/csiborgtools/flow/flow_model.py index e2e0865..4cfdcb1 100644 --- a/csiborgtools/flow/flow_model.py +++ b/csiborgtools/flow/flow_model.py @@ -607,10 +607,15 @@ class PV_LogLikelihood(BaseFlowValidationModel): Vmono = field_calibration_params["Vmono"] Vext_rad = project_Vext(Vext[0], Vext[1], Vext[2], self.RA, self.dec) + e_mu = distmod_params["e_mu"] + + # Jeffrey's prior on sigma_v and the intrinsic scatter, they are above + # "sampled" from uniform distributions. + ll0 -= jnp.log(sigma_v) + jnp.log(e_mu) + # ------------------------------------------------------------ # 1. Sample true observables and obtain the distance estimate # ------------------------------------------------------------ - e_mu = distmod_params["e_mu"] if self.kind == "SN": mag_cal = distmod_params["mag_cal"] alpha_cal = distmod_params["alpha_cal"] @@ -624,6 +629,9 @@ class PV_LogLikelihood(BaseFlowValidationModel): c_mean, c_std = sample_gaussian_hyperprior( "c", self.name, self.c_min, self.c_max) + # Jeffrey's prior on the the MNR hyperprior widths. + ll0 -= jnp.log(mag_std) + jnp.log(x1_std) + jnp.log(c_std) + # NOTE: that the true variables are currently uncorrelated. with plate(f"true_SN_{self.name}", self.ndata): mag_true = sample( @@ -675,6 +683,9 @@ class PV_LogLikelihood(BaseFlowValidationModel): corr_mag_eta = sample( f"corr_mag_eta_{self.name}", Uniform(-1, 1)) + # Jeffrey's prior on the the MNR hyperprior widths. + ll0 -= jnp.log(mag_std) + jnp.log(eta_std) + loc = jnp.array([mag_mean, eta_mean]) cov = jnp.array( [[mag_std**2, corr_mag_eta * mag_std * eta_std],