Likelihood Functions

class radvel.likelihood.CeleriteLikelihood(model: RVModel, t: ndarray, vel: ndarray, errvel: ndarray, hnames: list[str], suffix: str = '', **kwargs)[source]

Celerite GP Likelihood The Likelihood object for a radial velocity dataset modeled with a GP whose kernel is an approximation to the quasi-periodic kernel. See celerite.readthedocs.io and Foreman-Mackey et al. 2017. AJ, 154, 220 (equation 56) for more details. See radvel/example_planets/k2-131_celerite.py for an example of a setup file that uses this Likelihood object. :param model: RVModel object :type model: radvel.model.RVModel :param t: time array :type t: array :param vel: array of velocities :type vel: array :param errvel: array of velocity uncertainties :type errvel: array :param hnames: keys corresponding to radvel.Parameter

objects in model.params that are GP hyperparameters

Parameters:

suffix (string) – suffix to identify this Likelihood object; useful when constructing a CompositeLikelihood object

logprob() float[source]

Return GP log-likelihood given the data and model. log-likelihood is computed using Cholesky decomposition as: .. math:

lnL = -0.5r^TK^{-1}r - 0.5ln[det(K)] - 0.5N*ln(2pi)

where r = vector of residuals (GPLikelihood._resids), K = covariance matrix, and N = number of datapoints. Priors are not applied here. Constant has been omitted. :returns: Natural log of likelihood :rtype: float

predict(xpred: ArrayLike) tuple[ndarray, ndarray][source]

Realize the GP using the current values of the hyperparameters at values x=xpred. Used for making GP plots. Wrapper for celerite.GP.predict(). :param xpred: numpy array of x values for realizing the GP :type xpred: np.array

Returns:

tuple containing:

np.array: numpy array of predictive means

np.array: numpy array of predictive standard deviations

Return type:

tuple

class radvel.likelihood.CompositeLikelihood(like_list: list[RVLikelihood])[source]

Composite Likelihood A thin wrapper to combine multiple Likelihood objects. One Likelihood applies to a dataset from a particular instrument. :param like_list: list of radvel.likelihood.RVLikelihood objects :type like_list: list

errorbars() ndarray[source]

See radvel.likelihood.RVLikelihood.errorbars

logprob() float[source]

See radvel.likelihood.RVLikelihood.logprob

residuals() ndarray[source]

See radvel.likelihood.RVLikelihood.residuals

class radvel.likelihood.GPLikelihood(model: RVModel, t: ndarray, vel: ndarray, errvel: ndarray, hnames: list[str] = ['gp_per', 'gp_perlength', 'gp_explength', 'gp_amp'], suffix: str = '', kernel_name: str = 'QuasiPer', **kwargs)[source]

GP Likelihood The Likelihood object for a radial velocity dataset modeled with a GP :param model: GP model object :type model: radvel.model.GPModel :param t: time array :type t: array :param vel: array of velocities :type vel: array :param errvel: array of velocity uncertainties :type errvel: array :param hnames: keys corresponding to radvel.Parameter

objects in model.params that are GP hyperparameters

Parameters:

suffix (string) – suffix to identify this Likelihood object; useful when constructing a CompositeLikelihood object

logprob() float[source]

Return GP log-likelihood given the data and model. log-likelihood is computed using Cholesky decomposition as: .. math:

lnL = -0.5r^TK^{-1}r - 0.5ln[det(K)] - 0.5N*ln(2pi)

where r = vector of residuals (GPLikelihood._resids), K = covariance matrix, and N = number of datapoints. Priors are not applied here. Constant has been omitted. :returns: Natural log of likelihood :rtype: float

predict(xpred: ArrayLike) tuple[ndarray, ndarray][source]

Realize the GP using the current values of the hyperparameters at values x=xpred. Used for making GP plots. :param xpred: numpy array of x values for realizing the GP :type xpred: np.array

Returns:

tuple containing:

np.array: the numpy array of predictive means

np.array: the numpy array of predictive standard deviations

Return type:

tuple

residuals() ndarray[source]

Residuals Data minus (orbit model + predicted mean of GP noise model). For making GP plots.

update_kernel_params() None[source]

Update the Kernel object with new values of the hyperparameters

class radvel.likelihood.Likelihood(model: GeneralRVModel, x: ndarray, y: ndarray, yerr: ndarray, extra_params: list[str] = [], decorr_params: list[str] = [], decorr_vectors: list[ArrayLike] = [])[source]

Generic Likelihood

aic() float[source]

Calculate the Aikike information criterion The Small Sample AIC (AICC) is returned because for most RV data sets n < 40 * k (see Burnham & Anderson 2002 S2.4). :returns: AICC :rtype: float

bic() float[source]

Calculate the Bayesian information criterion :returns: BIC :rtype: float

class radvel.likelihood.RVLikelihood(model: GeneralRVModel, t: ndarray, vel: ndarray, errvel: ndarray, suffix: str = '', decorr_vars: list[str] = [], decorr_vectors: list[ArrayLike] = [], **kwargs)[source]

RV Likelihood The Likelihood object for a radial velocity dataset :param model: RV model object :type model: radvel.model.RVModel :param t: time array :type t: array :param vel: array of velocities :type vel: array :param errvel: array of velocity uncertainties :type errvel: array :param suffix: suffix to identify this Likelihood object

useful when constructing a CompositeLikelihood object.

errorbars() ndarray[source]

Return uncertainties with jitter added in quadrature. :returns: uncertainties :rtype: array

logprob() float[source]

Return log-likelihood given the data and model. Priors are not applied here. :returns: Natural log of likelihood :rtype: float

residuals() ndarray[source]

Residuals Data minus model

radvel.likelihood.loglike_jitter(residuals: ArrayLike, sigma: ArrayLike, sigma_jit: float | ndarray) float[source]

Log-likelihood incorporating jitter See equation (1) in Howard et al. 2014. Returns loglikelihood, where sigma**2 is replaced by sigma**2 + sigma_jit**2. It penalizes excessively large values of jitter :param residuals: array of residuals :type residuals: array :param sigma: array of measurement errors :type sigma: array :param sigma_jit: jitter :type sigma_jit: float

Returns:

log-likelihood

Return type:

float