Skip to content

Commit

Permalink
Fix doc example, and remove LaTeXStrings (#94)
Browse files Browse the repository at this point in the history
* Fix doc example, and remove LaTeXStrings

* vers
  • Loading branch information
DanielVandH committed Dec 5, 2023
1 parent 42d6403 commit 2268df9
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ProfileLikelihood"
uuid = "3fca794e-44fa-49a6-b6a0-8cd45572ba0a"
authors = ["Daniel VandenHeuvel <danj.vandenheuvel@gmail.com>"]
version = "0.3.3"
version = "0.3.4"

[deps]
ChunkSplitters = "ae650224-84b6-46f8-82ea-d812ca08434e"
Expand Down
1 change: 0 additions & 1 deletion docs/src/exponential.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ using OrdinaryDiffEq
using ProfileLikelihood
using Optimization
using CairoMakie
using LaTeXStrings
using Random
using Distributions
using MuladdMacro
Expand Down
5 changes: 2 additions & 3 deletions docs/src/heat.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ using Random
using LinearSolve
using OrdinaryDiffEq
using CairoMakie
using LaTeXStrings
using StaticArraysCore
using Optimization
using OptimizationNLopt
Expand Down Expand Up @@ -240,7 +239,7 @@ Confidence intervals:
See that all the true parameter intervals are inside these confidence intervals except for $k$, although $c$'s upper bound is right at the bounds we gave it in the problem. Let's now view the profile curves.

```julia
using CairoMakie, LaTeXStrings
using CairoMakie
fig = plot_profiles(prof; nrow=1, ncol=3,
latex_names=[L"k", L"c", L"u_0"],
true_vals=[k[1], c, u₀],
Expand Down Expand Up @@ -615,7 +614,7 @@ prof = profile(likprob, mle_sol; alg=NLopt.LN_BOBYQA,
resolution=60)

## Step 8: Visualise
using CairoMakie, LaTeXStrings
using CairoMakie
fig = plot_profiles(prof; nrow=1, ncol=3,
latex_names=[L"k", L"c", L"u_0"],
true_vals=[k[1], c, u₀],
Expand Down
3 changes: 1 addition & 2 deletions docs/src/logistic.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ using ProfileLikelihood
using Optimization
using OrdinaryDiffEq
using CairoMakie
using LaTeXStrings
using OptimizationNLopt
using Test
using StableRNGs
Expand Down Expand Up @@ -110,7 +109,7 @@ Confidence intervals:
We can visualise as we did before:

```julia
using CairoMakie, LaTeXStrings
using CairoMakie
fig = plot_profiles(prof;
latex_names=[L"\lambda", L"K", L"u_0"],
show_mles=true,
Expand Down
5 changes: 2 additions & 3 deletions docs/src/regression.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ using Random
using PreallocationTools
using Distributions
using CairoMakie
using LaTeXStrings
using LinearAlgebra
using Optimization
using OptimizationOptimJL
Expand Down Expand Up @@ -178,7 +177,7 @@ prof(0.50, 4)
We can now also visualise the results. In the plot below, the red line is at the threshold for the confidence region, so that the parameters between these values define the confidence interval. The red lines are at the MLEs, and the black lines are at the true values.

```julia
using CairoMakie, LaTeXStrings
using CairoMakie
fig = plot_profiles(prof;
latex_names=[L"\sigma", L"\beta_0", L"\beta_1", L"\beta_2", L"\beta_3"], # default names would be of the form θᵢ
show_mles=true,
Expand All @@ -189,7 +188,7 @@ fig = plot_profiles(prof;
xlims!(fig.content[1], 0.045, 0.055) # fix the ranges
xlims!(fig.content[2], -1.025, -0.975)
xlims!(fig.content[4], 0.475, 0.525)
resize_to_layout!9fig)
resize_to_layout!(fig)
```

```@raw html
Expand Down
3 changes: 1 addition & 2 deletions src/bivariate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ Computes bivariates profile likelihoods for the parameters from a likelihood pro
this function using `Symbols`, e.g. if `get_syms(prob) = [:λ, :K, :u₀]`, then calling `bivariate_profile(prob, sol, ((:λ, :K), (:K, u₀)))`
is the same as calling `bivariate_profile(prob, sol, ((1, 2), (2, 3)))` (the integer coordinate representation is still used in the solution, though).
For plotting, see the `plot_profiles` function (requires that you have loaded CairoMakie.jl and
LaTeXStrings.jl to access the function).
For plotting, see the `plot_profiles` function (requires that you have loaded a backend of Makie.jl).
# Arguments
- `prob::LikelihoodProblem`: The [`LikelihoodProblem`](@ref).
Expand Down
3 changes: 1 addition & 2 deletions src/profile_likelihood.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const dict_lock = ReentrantLock()
Computes profile likelihoods for the parameters from a likelihood problem `prob` with MLEs `sol`.
See also [`replace_profile!`](@ref) which allows you to re-profile a parameter in case you are not satisfied with
the results. For plotting, see the `plot_profiles` function (requires that you have loaded CairoMakie.jl and
LaTeXStrings.jl to access the function).
the results. For plotting, see the `plot_profiles` function (requires that you have loaded a backend of Makie.jl).
# Arguments
- `prob::LikelihoodProblem`: The [`LikelihoodProblem`](@ref).
Expand Down
2 changes: 1 addition & 1 deletion test/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.0-rc2"
manifest_format = "2.0"
project_hash = "40117e3c9c4592f6a041cc79b3e1d123b5f6edfb"
project_hash = "fb8efbffffc3f376dc902b6951a77b5075734dd5"

[[deps.ADTypes]]
git-tree-sha1 = "332e5d7baeff8497b923b730b994fa480601efc7"
Expand Down
1 change: 0 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
InvertedIndices = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LatinHypercubeSampling = "a5e1c1ea-c99a-51d3-a14d-a9a37257b02d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
Expand Down
1 change: 0 additions & 1 deletion test/bivariate_profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ using ..ProfileLikelihood
using Optimization
using OrdinaryDiffEq
using CairoMakie
using LaTeXStrings
using OptimizationNLopt
using Distributions
using PreallocationTools
Expand Down
3 changes: 1 addition & 2 deletions test/linear_exponential_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ using OrdinaryDiffEq
using ..ProfileLikelihood
using Optimization
using CairoMakie
using LaTeXStrings
using Random
using Distributions
using MuladdMacro
Expand Down Expand Up @@ -154,7 +153,7 @@ prof2 = profile(prob, sol; alg=NLopt.LN_NELDERMEAD, parallel=false)
prof = prof1

## Step 5: Visualise
using CairoMakie, LaTeXStrings
using CairoMakie
fig = plot_profiles(prof; nrow=1, ncol=3,
latex_names=[L"\lambda", L"\sigma", L"y_0"],
true_vals=[λ, σ, y₀],
Expand Down
3 changes: 1 addition & 2 deletions test/logistic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ using ..ProfileLikelihood
using Optimization
using OrdinaryDiffEq
using CairoMakie
using LaTeXStrings
using OptimizationOptimJL
using OptimizationNLopt
using StableRNGs
Expand Down Expand Up @@ -106,7 +105,7 @@ prof2 = profile(prob, sol; alg=NLopt.LN_NELDERMEAD, parallel=true)

prof = prof1

using CairoMakie, LaTeXStrings
using CairoMakie
fig = plot_profiles(prof;
latex_names=[L"\lambda", L"K", L"u_0"],
show_mles=true,
Expand Down
1 change: 0 additions & 1 deletion test/lotka_volterra_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ using ..ProfileLikelihood
using Optimization
using OrdinaryDiffEq
using CairoMakie
using LaTeXStrings
using OptimizationNLopt
using LoopVectorization
using PolygonOps
Expand Down
1 change: 0 additions & 1 deletion test/profile_likelihood.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ using InteractiveUtils
using DelaunayTriangulation
using Interpolations
using CairoMakie
using LaTeXStrings
include("templates.jl")

@testset "Test that we can correctly construct the parameter ranges" begin
Expand Down
3 changes: 1 addition & 2 deletions test/regression_example.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ using Random
using PreallocationTools
using Distributions
using CairoMakie
using LaTeXStrings
using LinearAlgebra
using Optimization
using OptimizationOptimJL
Expand Down Expand Up @@ -131,7 +130,7 @@ prof(0.50, 4)
@test prof[:β₂](0.50) == prof(0.50, :β₂) == prof(0.50, 4)

## Step 5: Visualise
using CairoMakie, LaTeXStrings
using CairoMakie
fig = plot_profiles(prof;
latex_names=[L"\sigma", L"\beta_0", L"\beta_1", L"\beta_2", L"\beta_3"], # default names would be of the form θᵢ
show_mles=true,
Expand Down

0 comments on commit 2268df9

Please sign in to comment.