bilby.core.likelihood.StudentTLikelihood

class bilby.core.likelihood.StudentTLikelihood(x, y, func, nu=None, sigma=1, **kwargs)[source]

Bases: Analytical1DLikelihood

__init__(x, y, func, nu=None, sigma=1, **kwargs)[source]

A general Student’s t-likelihood for known or unknown number of degrees of freedom, and known or unknown scale (which tends toward the standard deviation for large numbers of degrees of freedom) - the model parameters are inferred from the arguments of function

https://en.wikipedia.org/wiki/Student%27s_t-distribution#Generalized_Student’s_t-distribution

Parameters:
x, y: array_like

The data to analyse

func:

The python function to fit to the data. Note, this must take the dependent variable as its first argument. The other arguments will require a prior and will be sampled over (unless a fixed value is given).

nu: None, float

If None, the number of degrees of freedom of the noise is unknown and will be estimated (note: this requires a prior to be given for nu). If not None, this defines the number of degrees of freedom of the data points. As an example a nu of len(x)-2 is equivalent to having marginalised a Gaussian distribution over an unknown standard deviation parameter using a uniform prior.

sigma: 1.0, float

Set the scale of the distribution. If not given then this defaults to 1, which specifies a standard (central) Student’s t-distribution

__call__(*args, **kwargs)

Call self as a function.

Methods

__init__(x, y, func[, nu, sigma])

A general Student's t-likelihood for known or unknown number of degrees of freedom, and known or unknown scale (which tends toward the standard deviation for large numbers of degrees of freedom) - the model parameters are inferred from the arguments of function

log_likelihood()

log_likelihood_ratio()

Difference between log likelihood and noise log likelihood

noise_log_likelihood()

Attributes

func

Make func read-only

function_keys

Makes function_keys read_only

lam

Converts 'scale' to 'precision'

marginalized_parameters

meta_data

model_parameters

This sets up the function only parameters (i.e. not sigma for the GaussianLikelihood) .

n

The number of data points

nu

This checks if nu or sigma have been set in parameters.

residual

Residual of the function against the data.

x

The independent variable.

y

The dependent variable.

property func

Make func read-only

property function_keys

Makes function_keys read_only

property lam

Converts ‘scale’ to ‘precision’

log_likelihood()[source]
Returns:
float
log_likelihood_ratio()[source]

Difference between log likelihood and noise log likelihood

Returns:
float
property model_parameters

This sets up the function only parameters (i.e. not sigma for the GaussianLikelihood)

property n

The number of data points

noise_log_likelihood()[source]
Returns:
float
property nu

This checks if nu or sigma have been set in parameters. If so, those values will be used. Otherwise, the attribute nu is used. The logic is that if nu is not in parameters the attribute is used which was given at init (i.e. the known nu as a float).

property residual

Residual of the function against the data.

property x

The independent variable. Setter assures that single numbers will be converted to arrays internally

property y

The dependent variable. Setter assures that single numbers will be converted to arrays internally