Univariate Functions
LikelihoodBasedProfileWiseAnalysis.add_uni_profiles_rows!LikelihoodBasedProfileWiseAnalysis.get_interval_bracketsLikelihoodBasedProfileWiseAnalysis.get_points_in_interval_single_rowLikelihoodBasedProfileWiseAnalysis.get_univariate_opt_funcLikelihoodBasedProfileWiseAnalysis.set_uni_profiles_row!LikelihoodBasedProfileWiseAnalysis.univariate_confidenceintervalLikelihoodBasedProfileWiseAnalysis.univariateψLikelihoodBasedProfileWiseAnalysis.univariateψ_ellipse_unboundedLikelihoodBasedProfileWiseAnalysis.update_uni_dict_internal!
Likelihood Optimisation
LikelihoodBasedProfileWiseAnalysis.univariateψ_ellipse_unbounded — Functionunivariateψ_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.
LikelihoodBasedProfileWiseAnalysis.univariateψ — Functionunivariateψ(ψ::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.
Get Points in Confidence Interval
LikelihoodBasedProfileWiseAnalysis.update_uni_dict_internal! — Functionupdate_uni_dict_internal!(model::LikelihoodModel,
uni_row_number::Int,
points::PointsAndLogLikelihood)Updates the interval_points field of a UnivariateConfidenceStruct, for the profile related to uni_row_number stored at model.uni_profiles_dict[uni_row_number], with the interval points stored in points.
LikelihoodBasedProfileWiseAnalysis.get_points_in_interval_single_row — Functionget_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.
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!.
Main Confidence Interval Logic
LikelihoodBasedProfileWiseAnalysis.get_interval_brackets — Functionget_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[]).
LikelihoodBasedProfileWiseAnalysis.add_uni_profiles_rows! — Functionadd_uni_profiles_rows!(model::LikelihoodModel, num_rows_to_add::Int)Adds num_rows_to_add free rows to model.uni_profiles_df by vertically concatenating the existing DataFrame and free rows using LikelihoodBasedProfileWiseAnalysis.init_uni_profiles_df.
LikelihoodBasedProfileWiseAnalysis.set_uni_profiles_row! — Functionset_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.
LikelihoodBasedProfileWiseAnalysis.get_univariate_opt_func — Functionget_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.
LikelihoodBasedProfileWiseAnalysis.univariate_confidenceinterval — Functionunivariate_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!.