confidence_interval

Module that is used to calculate the confidence interval given the estimated parameters

pygom.loss.confidence_interval.asymptotic(obj, alpha=0.05, theta=None, lb=None, ub=None)

Finds the confidence interval at the \(\alpha\) level under the \(\mathcal{X}^{2}\) assumption for the likelihood

Parameters:
obj: ode object

an object initialized from BaseLoss

alpha: numeric, optional

confidence level, \(0 < \alpha < 1\). Defaults to 0.05.

theta: array like, optional

the MLE parameters. Defaults to None which then theta will be inferred from the input obj

lb: array like, optional

expected lower bound

ub: array like, optional

expected upper bound

Returns:
l: array like

lower confidence interval

u: array like

upper confidence interval

pygom.loss.confidence_interval.profile(obj, alpha, theta=None, lb=None, ub=None, full_output=False)

Finds the profile confidence interval at the \(\alpha\) level under the \(\mathcal{X}^{2}\) assumption for the likelihood

Parameters:
obj: ode object

an object initialized from BaseLoss

alpha: numeric

confidence level, \(0 < \alpha < 1\)

theta: array like, optional

the MLE parameters. When None given, it tries to estimate the optimal using methods provided by obj

lb: array like, optional

expected lower bound

ub: array like, optional

expected upper bound

full_output: bool, optional

if more output is desired

Returns:
l: array like

lower confidence interval

u: array like

upper confidence interval

pygom.loss.confidence_interval.bootstrap(obj, alpha=0.05, theta=None, lb=None, ub=None, iteration=0, full_output=False)

Finds the confidence interval at the \(\alpha\) level via bootstrap

Parameters:
obj: ode object

an object initialized from BaseLoss

alpha: numeric, optional

confidence level, \(0 < \alpha < 1\). Defaults to 0.05.

theta: array like, optional

the MLE parameters

lb: array like, optional

upper bound for the parameters

ub: array like, optional

lower bound for the parameters

iteration: int, optional

number of bootstrap samples, defaults to 0 which is interpreted as \(min(2n, 100)\) where \(n\) is the number of data points.

full_output: bool

if the full set of estimates is required.

Returns:
l: array like

lower confidence interval

u: array like

upper confidence interval

pygom.loss.confidence_interval.geometric(obj, alpha=0.05, theta=None, method='jtj', geometry='o', full_output=False)

Finds the geometric confidence interval under profiling at the \(\alpha\) level the normal approximation

Parameters:
obj: ode object

an object initialized from BaseLoss

alpha: numeric

confidence level, \(0 < \alpha < 1\)

theta: array like, optional

the MLE parameters. When None given, it tries to estimate the optimal using methods provided by obj

method: string

construction of the covariance matrix. jtj is the \(J^{\top}\) where \(J\) is the Jacobian of the ode. ‘hessian’ is the hessian of the ode while ‘fisher’ is the fisher information found by \(cov(\nabla_{\theta}\mathcal{L})\).

geometry: string

the two types of geometry defined in [Moolgavkar1987]. c geometry uses the covariance at the maximum likelihood estimate \(\hat{\theta}\), while the ‘o’ geometry is the covariance defined at point \(\theta\).

full_output: bool, optional

If True then both the l_path and u_path will be outputted, else only the point estimates of l and u

Returns:
l: array like

lower confidence interval

u: array like

upper confidence interval

l_path: list

path from \(\hat{\theta}\) to the lower \(1 - \alpha/2\) point for all parameters

u_path: list

same as l_path but for the upper confidence interval