Univariate Functions

Likelihood Optimisation

LikelihoodBasedProfileWiseAnalysis.univariateψ_ellipse_unboundedFunction
univariateψ_ellipse_unbounded(ψ::Real, p::NamedTuple)

Given an ellipse approximation of a log-likelihood function (LikelihoodBasedProfileWiseAnalysis.ellipse_loglike) which is unbounded in parameter space, this function finds the values of the nuisance parameters ω that optimise the function at fixed values of the interest parameter ψ and returns the approximated log-likelihood value minus the confidence interval target threshold. The returned function value will be zero at the locations of the approximate confidence interval for ψ, which correspond to the locations found by LikelihoodBasedProfileWiseAnalysis.analytic_ellipse_loglike_1D_soln. Nuisance parameter values are stored in the NamedTuple p.

source
LikelihoodBasedProfileWiseAnalysis.univariateψFunction
univariateψ(ψ::Real, p::NamedTuple)

Given a log-likelihood function (p.consistent.loglikefunction) which is bounded in parameter space and may be an ellipse approximation, this function finds the values of the nuisance parameters ω that optimise the function fixed values of the interest parameter ψ and returns the log-likelihood value minus the confidence interval target threshold. The returned function value will be zero at the locations of the approximate confidence interval for ψ. Nuisance parameter values are stored in the NamedTuple p at p.ω_opt.

source

Get Points in Confidence Interval

LikelihoodBasedProfileWiseAnalysis.get_points_in_interval_single_rowFunction
get_points_in_interval_single_row(univariate_optimiser::Function, 
    model::LikelihoodModel,
    num_points_in_interval::Int,
    θi::Int,
    profile_type::AbstractProfileType,
    θlb_nuisance::AbstractVector{<:Real},
    θub_nuisance::AbstractVector{<:Real},
    current_interval_points::PointsAndLogLikelihood,
    additional_width::Real,
    use_threads::Bool)

Method for getting num_points_in_interval points inside a confidence interval for parameter θi, directly called by LikelihoodBasedProfileWiseAnalysis.univariate_confidenceinterval and called via it's other method for get_points_in_intervals!. Adds additional_width outside of the confidence interval, so long as a parameter bound is not reached. If a bound is reached, up until the bound will be considered instead.

source
get_points_in_interval_single_row(model::LikelihoodModel,
    uni_row_number::Int,
    num_points_in_interval::Int,
    additional_width::Real,
    θlb_nuisance::AbstractVector{<:Real},
    θub_nuisance::AbstractVector{<:Real},
    use_threads::Bool,
    channel::RemoteChannel)

Alternate method called by get_points_in_intervals!.

source

Main Confidence Interval Logic

LikelihoodBasedProfileWiseAnalysis.get_interval_bracketsFunction
get_interval_brackets(model::LikelihoodModel, 
    θi::Int, 
    confidence_level::Float64, 
    dof::Int,
    profile_type::AbstractProfileType)

Returns updated interval brackets (Float64 vectors of length two) if smaller or larger confidence level profiles exist for θi at degrees of freedom, dof, such that the region to bracket over for the left and right sides of the confidence interval is smallest. Otherwise, returns empty brackets (Float64[]).

source
LikelihoodBasedProfileWiseAnalysis.set_uni_profiles_row!Function
set_uni_profiles_row!(model::LikelihoodModel, 
    row_ind::Int, 
    θi::Int,
    not_evaluated_internal_points::Bool, 
    not_evaluated_predictions::Bool,
    confidence_level::Float64, 
    dof::Int,
    profile_type::AbstractProfileType, 
    num_points::Int, 
    additional_width::Real)

Sets the relevant fields of row row_ind in model.uni_profiles_df after a profile has been evaluated.

source
LikelihoodBasedProfileWiseAnalysis.get_univariate_opt_funcFunction
get_univariate_opt_func(profile_type::AbstractProfileType=LogLikelihood())

Returns the correct univariate optimisation function used to for find the optimal values of nuisance parameters for a given interest parameter value for the profile_type log-likelihood function. The optimisation function returns the value of the profile_type log-likelihood function as well as finding the optimal nuisance parameters and saving these in one of it's inputs.

Will be LikelihoodBasedProfileWiseAnalysis.univariateψ for the LogLikelihood() and EllipseApprox() profiles types and LikelihoodBasedProfileWiseAnalysis.univariateψ_ellipse_unbounded for the EllipseApproxAnalytical profile type.

source
LikelihoodBasedProfileWiseAnalysis.univariate_confidenceintervalFunction
univariate_confidenceinterval!(p::Progress,
    univariate_optimiser::Function, 
    model::LikelihoodModel, 
    consistent::NamedTuple, 
    θi::Int, 
    confidence_level::Float64,
    dof::Int,
    profile_type::AbstractProfileType,
    θlb_nuisance::AbstractVector{<:Real},
    θub_nuisance::AbstractVector{<:Real},
    mle_targetll::Float64,
    use_existing_profiles::Bool,
    use_ellipse_approx_analytical_start::Bool,
    num_points_in_interval::Int,
    additional_width::Real,
    find_zero_atol::Real,
    optimizationsettings::OptimizationSettings,
    use_threads::Bool,
    channel::RemoteChannel)

Returns a UnivariateConfidenceStruct containing the likelihood-based confidence interval for interest parameter θi at confidence_level, and any additional points within the interval if num_points_in_interval > 0 as well as outside the interval if num_points_in_interval > 0 and additional_width > 0. Log-likelihood values, standardised to 0.0 at the MLE point, for all points found in the interval are also stored in the UnivariateConfidenceStruct.

If use_existing_profiles=true then the brackets used to find each side of the confidence interval (between each side of the bounds for θi and the MLE point), will be updated and made smaller if confidence profiles for θi already exist at lower and higher confidence levels.

Called by univariate_confidenceintervals!.

source