Dimensional Functions

Common Full and Dimensional Likelihood

LikelihoodBasedProfileWiseAnalysis.set_dim_samples_row!Function
set_dim_samples_row!(model::LikelihoodModel, 
    row_ind::Int,
    θindices::Vector{Int},
    not_evaluated_predictions::Bool,
    confidence_level::Float64,
    sample_type::AbstractSampleType,
    num_points::Int)

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

source
LikelihoodBasedProfileWiseAnalysis.valid_pointsFunction
valid_points(model::LikelihoodModel, 
    grid::Matrix{Float64},
    grid_size::Int,
    confidence_level::Float64, 
    num_dims::Int,
    use_threads::Bool,
    use_distributed::Bool,
    channel::RemoteChannel)

Given a grid of grid_size points in full parameter space with num_dims dimensions, this function evaluates the log-likelihood function at each point and returns the points that are within the confidence_level log-likelihood threshold as a num_dims * n array, alongside a vector of their log-likelihood values. Log-likelihood values are standardised to 0.0 at the MLE point.

source
valid_points(model::LikelihoodModel, 
    p::NamedTuple, 
    grid::Matrix{Float64},
    grid_size::Int,
    confidence_level::Float64, 
    dof::Int,
    num_dims::Int,
    use_threads::Bool,
    channel::RemoteChannel)

Given a grid of grid_size points in interest parameter space with num_dims dimensions, this function finds the values of nuisance parameters that maximise the log-likelihood function at each point and returns the points that are within the confidence_level, dof, log-likelihood threshold as a num_dims * n array, alongside a vector of their log-likelihood values. Log-likelihood values are standardised to 0.0 at the MLE point.

source
LikelihoodBasedProfileWiseAnalysis.check_if_bounds_suppliedFunction
check_if_bounds_supplied(model::LikelihoodModel,
    lb::AbstractVector{<:Real},
    ub::AbstractVector{<:Real})

Returns the model bounds on full parameter space if lb and ub are empty, and lb and ub otherwise.

source
check_if_bounds_supplied(model::LikelihoodModel,
    lb::AbstractVector{<:Real},
    ub::AbstractVector{<:Real})

Returns the model bounds on interest parameter space if lb and ub are empty, and lb and ub for interest parameter indices otherwise.

source
LikelihoodBasedProfileWiseAnalysis.uniform_gridFunction
uniform_grid(model::LikelihoodModel,
    points_per_dimension::Union{Int, Vector{Int}},
    confidence_level::Float64,
    lb::AbstractVector{<:Real}=Float64[],
    ub::AbstractVector{<:Real}=Float64[];
    use_threads::Bool=true,
    use_distributed::Bool=false,
    arguments_checked::Bool=false,
    channel::RemoteChannel=RemoteChannel(() -> Channel{Bool}(Inf)))

Creates a uniform grid with points_per_dimension in each dimension, uniformly spaced between lb and ub if supplied or between the bounds contained in model.core.The log-likelihood function is evaluated at each grid point and all grid points within the confidence_level log-likelihood threshold are saved as a SampledConfidenceStruct. Points are saved alongside a vector of their log-likelihood values. Log-likelihood values are standardised to 0.0 at the MLE point.

For the UniformGridSamples sample type.

source
uniform_grid(model::LikelihoodModel,
    θindices::Vector{Int},
    points_per_dimension::Union{Int, Vector{Int}},
    confidence_level::Float64,
    dof::Int,
    lb::AbstractVector{<:Real}=Float64[],
    ub::AbstractVector{<:Real}=Float64[],
    θlb_nuisance::AbstractVector{<:Real}=model.core.θlb,
    θub_nuisance::AbstractVector{<:Real}=model.core.θub,
    optimizationsettings::OptimizationSettings=default_OptimizationSettings();
    use_threads=true,
    arguments_checked::Bool=false,
    channel::RemoteChannel=RemoteChannel(() -> Channel{Bool}(Inf)))

Creates a uniform grid on interest parameter space θindices with points_per_dimension in each interest dimension, uniformly spaced between lb[θindices] and ub[θindices] if supplied or between the bounds contained in model.core. The grid is then passed to LikelihoodBasedProfileWiseAnalysis.valid_points to determine the values of nuisance parameters that maximise log-likelihood function at each grid point. All grid points within the confidence_level log-likelihood threshold are then saved as a SampledConfidenceStruct. Points are saved alongside a vector of their log-likelihood values. Log-likelihood values are standardised to 0.0 at the MLE point.

For the UniformGridSamples sample type.

source
LikelihoodBasedProfileWiseAnalysis.uniform_randomFunction
uniform_random(model::LikelihoodModel,
    num_points::Int,
    confidence_level::Float64,
    lb::AbstractVector{<:Real}=Float64[],
    ub::AbstractVector{<:Real}=Float64[];
    use_threads::Bool=true,
    use_distributed::Bool=false,
    arguments_checked::Bool=false,
    channel::RemoteChannel=RemoteChannel(() -> Channel{Bool}(num_points+1)))

Creates a grid of num_points uniform random points sampled between lb and ub if supplied or between the bounds contained in model.core. The log-likelihood function is evaluated at each grid point and all grid points within the confidence_level log-likelihood threshold are saved as a SampledConfidenceStruct. Points are saved alongside a vector of their log-likelihood values. Log-likelihood values are standardised to 0.0 at the MLE point.

For the UniformRandomSamples sample type.

source
uniform_random(model::LikelihoodModel,
    num_points::Int,
    confidence_level::Float64,
    dof::Int,
    lb::AbstractVector{<:Real}=Float64[],
    ub::AbstractVector{<:Real}=Float64[],
    θlb_nuisance::AbstractVector{<:Real}=model.core.θlb,
    θub_nuisance::AbstractVector{<:Real}=model.core.θub,
    optimizationsettings::OptimizationSettings=default_OptimizationSettings();
    use_threads::Bool=true,
    use_distributed::Bool=false,
    arguments_checked::Bool=false,
    channel::RemoteChannel=RemoteChannel(() -> Channel{Bool}(num_points+1)))

Creates a grid of num_points uniform random points on interest parameter space θindices sampled between lb[θindices] and ub[θindices] if supplied or between the bounds contained in model.core. The grid is then passed to LikelihoodBasedProfileWiseAnalysis.valid_points to determine the values of nuisance parameters that maximise log-likelihood function at each grid point. All grid points within the confidence_level log-likelihood threshold are then saved as a SampledConfidenceStruct. Points are saved alongside a vector of their log-likelihood values. Log-likelihood values are standardised to 0.0 at the MLE point.

For the UniformRandomSamples sample type.

source
LikelihoodBasedProfileWiseAnalysis.LHSFunction
LHS(model::LikelihoodModel,
    num_points::Int,
    confidence_level::Float64,
    lb::AbstractVector{<:Real}=Float64[],
    ub::AbstractVector{<:Real}=Float64[];
    use_threads::Bool=true,
    use_distributed::Bool=false,
    arguments_checked::Bool=false,
    channel::RemoteChannel=RemoteChannel(() -> Channel{Bool}(num_points+1)))

Creates a grid of num_points points sampled using a Latin Hypercube sampling plan between lb and ub if supplied or between the bounds contained in model.core. The log-likelihood function is evaluated at each grid point and all grid points within the confidence_level log-likelihood threshold are saved as a SampledConfidenceStruct. Points are saved alongside a vector of their log-likelihood values. Log-likelihood values are standardised to 0.0 at the MLE point.

For the LatinHypercubeSamples sample type.

source
LHS(model::LikelihoodModel,
    θindices::Vector{Int},
    num_points::Int,
    confidence_level::Float64,
    dof::Int,
    lb::AbstractVector{<:Real}=Float64[],
    ub::AbstractVector{<:Real}=Float64[],
    θlb_nuisance::AbstractVector{<:Real}=model.core.θlb,
    θub_nuisance::AbstractVector{<:Real}=model.core.θub,
    optimizationsettings::OptimizationSettings=default_OptimizationSettings();
    use_threads::Bool=true,
    arguments_checked::Bool=false,
    channel::RemoteChannel=RemoteChannel(() -> Channel{Bool}(num_points+1)))

Creates a grid of num_points points on interest parameter space θindices using a Latin Hypercube sampling plan between lb[θindices] and ub[θindices] if supplied or between the bounds contained in model.core. The grid is then passed to LikelihoodBasedProfileWiseAnalysis.valid_points to determine the values of nuisance parameters that maximise log-likelihood function at each grid point. All grid points within the confidence_level log-likelihood threshold are then saved as a SampledConfidenceStruct. Points are saved alongside a vector of their log-likelihood values. Log-likelihood values are standardised to 0.0 at the MLE point.

For the LatinHypercubeSamples sample type.

source

Full Likelihood Only

LikelihoodBasedProfileWiseAnalysis.full_likelihood_sampleFunction
full_likelihood_sample(model::LikelihoodModel,
    num_points::Union{Int, Vector{Int}},
    confidence_level::Float64,
    sample_type::AbstractSampleType,
    lb::AbstractVector{<:Real},
    ub::AbstractVector{<:Real},
    use_threads::Bool,
    use_distributed::Bool,
    channel::RemoteChannel)

Calls the desired method for sampling parameter space, sample_type, and returns a SampledConfidenceStruct containing any points that were found within the confidence_level log-likelihood threshold.

source

Dimensional Likelihood Only

LikelihoodBasedProfileWiseAnalysis.dimensional_optimiser!Function
dimensional_optimiser!(θs_opt::Union{Vector, SubArray}, 
    q::NamedTuple, 
    options::OptimizationSettings, 
    targetll::Real)

Given a log-likelihood function (q.consistent.loglikefunction) which is bounded in parameter space, this function finds the values of the nuisance parameters ω that optimise the function for fixed values of the interest parameters ψ (which are already in θs_opt) and returns the log-likelihood value minus the confidence boundary target threshold. The returned function value will be zero at the locations of the approximate confidence boundary for ψ. Nuisance parameter values are stored in the corresponding indices of θs_opt, modifying the array in place.

source
LikelihoodBasedProfileWiseAnalysis.dimensional_likelihood_sampleFunction
dimensional_likelihood_sample(model::LikelihoodModel,
    θindices::Vector{Int},
    num_points::Union{Int, Vector{Int}},
    confidence_level::Float64,
    dof::Int,
    sample_type::AbstractSampleType,
    lb::AbstractVector{<:Real},
    ub::AbstractVector{<:Real},
    θlb_nuisance::AbstractVector{<:Real},
    θub_nuisance::AbstractVector{<:Real},
    optimizationsettings::OptimizationSettings,
    use_threads::Bool,
    channel::RemoteChannel)

Calls the desired method for sampling interest parameter space, sample_type, and returns a SampledConfidenceStruct containing any points that were found within the confidence_level, `dof, log-likelihood threshold.

source