Skip to content

Commit

Permalink
Add optional inclusion of MLE point as initial internal point for sim…
Browse files Browse the repository at this point in the history
…ultaneous method
  • Loading branch information
JoelTrent committed Jun 28, 2023
1 parent bd59ba1 commit 6b526b7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/bivariate_methods/bivariate_profile_likelihood.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ function bivariate_confidenceprofile(bivariate_optimiser::Function,
bivariate_optimiser, model,
num_points, consistent, ind1, ind2,
mle_targetll, save_internal_points, channel,
min_proportion_unique=method.min_proportion_unique)
min_proportion_unique=method.min_proportion_unique,
use_MLE_point=method.use_MLE_point)

elseif method isa RadialRandomMethod
boundary, internal = bivariate_confidenceprofile_vectorsearch(
Expand Down
17 changes: 15 additions & 2 deletions src/bivariate_methods/vectorsearch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function findNpointpairs_simultaneous!(p::NamedTuple,
mle_targetll::Float64,
save_internal_points::Bool,
biv_opt_is_ellipse_analytical::Bool,
min_proportion_unique::Real)
min_proportion_unique::Real,
use_MLE_point::Bool)

internal = zeros(2,num_points)
internal_all = zeros(model.core.num_pars, save_internal_points ? num_points : 0)
Expand All @@ -28,6 +29,12 @@ function findNpointpairs_simultaneous!(p::NamedTuple,

Ninside=0; Noutside=0
iters=0

if use_MLE_point
Ninside +=1
internal[:,Ninside] = model.core.θmle[[ind1, ind2]]
end

while Noutside<num_points && Ninside<num_points

x, y = generatepoint(model, ind1, ind2)
Expand Down Expand Up @@ -104,6 +111,11 @@ function findNpointpairs_simultaneous!(p::NamedTuple,
end
end

if use_MLE_point
ll_values = ll_values[2:end]
internal_all = internal_all[:, 2:end]
end

if save_internal_points && biv_opt_is_ellipse_analytical
get_ωs_bivariate_ellipse_analytical!(internal_all, num_points,
p.consistent, ind1, ind2,
Expand Down Expand Up @@ -288,6 +300,7 @@ function bivariate_confidenceprofile_vectorsearch(bivariate_optimiser::Function,
channel::RemoteChannel;
num_radial_directions::Int=0,
min_proportion_unique::Real=1.0,
use_MLE_point::Bool=false,
ellipse_confidence_level::Float64=-1.0,
ellipse_start_point_shift::Float64=0.0,
ellipse_sqrt_distortion::Float64=0.0)
Expand Down Expand Up @@ -318,7 +331,7 @@ function bivariate_confidenceprofile_vectorsearch(bivariate_optimiser::Function,
internal, internal_all, ll_values, external =
findNpointpairs_simultaneous!(p, bivariate_optimiser, model, num_points, ind1, ind2,
mle_targetll, save_internal_points, biv_opt_is_ellipse_analytical,
min_proportion_unique)
min_proportion_unique, use_MLE_point)
else
internal, internal_all, ll_values, external =
findNpointpairs_radialrandom!(p, bivariate_optimiser, model, num_points,
Expand Down
10 changes: 6 additions & 4 deletions src/types/bivariate_methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,14 @@ struct RadialRandomMethod <: AbstractBivariateVectorMethod
end

"""
SimultaneousMethod(min_proportion_unique::Real=0.5)
SimultaneousMethod(min_proportion_unique::Real=0.5, include_MLE_point::Bool=true)
Method for finding the bivariate boundary of a confidence profile by finding internal and external boundary points using a uniform random distribution on provided bounds, pairing these points in the order they're found and bracketing between each pair (see [`PlaceholderLikelihood.findNpointpairs_simultaneous!`](@ref) and [`PlaceholderLikelihood.bivariate_confidenceprofile_vectorsearch`](@ref)). Values of `min_proportion_unique` lower than zero may improve performance if finding either internal points or external points is difficult given the specified bounds on interest parameters.
# Arguments
- `min_proportion_unique`: a proportion ∈ (0.0, 1.0] for the minimum allowed proportion of unique points in one of the internal or external point vectors. One of these vectors will be fully unique. Whichever vector is not unique, will have at least `min_proportion_unique` unique points. Default is 0.5
- `min_proportion_unique`: a proportion ∈ (0.0, 1.0] for the minimum allowed proportion of unique points in one of the internal or external point vectors. One of these vectors will be fully unique. Whichever vector is not unique, will have at least `min_proportion_unique` unique points. Default is 0.5.
- `use_MLE_point`: whether to use the MLE point as the first internal point found or not. Default is true (use).
# Details
Expand Down Expand Up @@ -277,9 +278,10 @@ Finds at least `ceil(min_proportion_unique * num_points)` internal points.
"""
struct SimultaneousMethod <: AbstractBivariateVectorMethod
min_proportion_unique::Real
function SimultaneousMethod(min_proportion_unique::Real=0.5)
use_MLE_point::Bool
function SimultaneousMethod(min_proportion_unique::Real=0.5, use_MLE_point::Bool=true)
(0.0 < min_proportion_unique && min_proportion_unique <= 1.0) || throw(DomainError("min_proportion_unique must be in the interval (0.0,1.0]"))
return new(min_proportion_unique)
return new(min_proportion_unique, use_MLE_point)
end
end

Expand Down

0 comments on commit 6b526b7

Please sign in to comment.