Skip to content

Commit b66ff1b

Browse files
committedFeb 9, 2024
Documentation updates. Make user interfaces slightly more readable by moving the @index block to the bottom of each page rather than the top. Fix links to example files
1 parent a2229b1 commit b66ff1b

18 files changed

+172
-69
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
TO DO
99

10-
An implementation and exploration of the [likelihood-based profile-wise analysis workflow](https://doi.org/10.1371/journal.pcbi.1011515) from Matthew Simpson and Oliver Maclaren.
10+
This package is an implementation and exploration of the [likelihood-based profile-wise analysis workflow](https://doi.org/10.1371/journal.pcbi.1011515) from Matthew Simpson and Oliver Maclaren.
1111

1212
The API is largely stable, but shouldn't be regarded as fixed until the first version is released; the package will be kept as v1.0.0-DEV until then. The main work remaining is in completing documentation. However, one of the bivariate boundary methods may be removed.
1313

‎docs/src/examples/binomial_normal_approximation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Gaussian Approximation of a Binomial Distribution
22

3-
The code included in this example is compiled into a single file [here](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl/-/tree/main/examples/binomial_normal_approximation.jl).
3+
The code included in this example is compiled into a single file [here](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl/blob/main/examples/binomial_normal_approximation.jl).
44

55
This model is taken from an unreleased paper by the authors of the workflow [simpsonprofilewise2023](@cite). The Binomial distribution is defined as:
66

‎docs/src/examples/logistic.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Logistic Model
22

3-
The code included in this example is compiled into a single file [here](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl/-/tree/main/examples/logistic.jl).
3+
The code included in this example is compiled into a single file [here](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl/blob/main/examples/logistic.jl).
44

55
The logistic model with a normal data distribution [simpsonprofilewise2023](@cite) has the following differential equation for the population density ``C(t)\geq0``:
66
```math

‎docs/src/examples/lotka-volterra.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Lotka-Volterra Model
22

3-
The code included in this example is compiled into a single file [here](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl/-/tree/main/examples/lotka-volterra.jl).
3+
The code included in this example is compiled into a single file [here](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl/blob/main/examples/lotka-volterra.jl).
44

55
The Lotka-Volterra model with a normal data distribution [simpsonprofilewise2023](@cite) has the following differential equations for the population size of the prey species ``x(t)`` and predator species ``y(t)``:
66

‎docs/src/examples/two-species_logistic.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Two-Species Logistic Model
22

3-
The code included in this example is compiled into a single file [here](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl/-/tree/main/examples/two-species_logistic.jl).
3+
The code included in this example is compiled into a single file [here](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl/blob/main/examples/two-species_logistic.jl).
44

55
The two-species logistic model with a Gaussian data distribution [simpsonprofile2023](@cite) has the following differential equations for the population densities of the two species ``C_1(t)\geq0`` and ``C_2(t)\geq0`` :
66
```math

‎docs/src/index.md

+48
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,51 @@ CurrentModule = LikelihoodBasedProfileWiseAnalysis
66

77
Documentation for [LikelihoodBasedProfileWiseAnalysis](https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl).
88

9+
This package is an implementation and exploration of the [likelihood-based Profile-Wise Analysis (PWA) workflow](https://doi.org/10.1371/journal.pcbi.1011515) from Matthew Simpson and Oliver Maclaren [simpsonprofilewise2023](@cite). It provides methods for:
10+
11+
- Maximum Likelihood Estimation.
12+
- Calculation of the observed Fisher information matrix (FIM) [pawitanall2001](@cite) and associated approximation of the log-likelihood function.
13+
- Parameter identifiability analysis.
14+
- Parameter confidence intervals.
15+
- Evaluating univariate profiles.
16+
- Evaluating the boundaries of bivariate profiles and sampling points within these boundaries.
17+
- Rejection sampling of full parameter vector confidence sets and profiles.
18+
- Simultaneous prediction of model solutions/trajectories using approximate profile-wise confidence trajectory sets.
19+
- Simultaneous prediction of population reference sets using approximate profile-wise reference tolerance sets.
20+
21+
Additionally, to assist with evaluating the frequentist coverage properties of intervals and sets within the PWA workflow on new models it provides methods for the coverage testing of:
22+
- Parameter confidence intervals.
23+
- Bivariate confidence profiles.
24+
- Profile-wise confidence trajectory sets.
25+
- Profile-wise reference tolerance sets.
26+
27+
To understand the background of the workflow and how it can be used see [Background](@ref). For implementation examples see the examples section, such as on a [Logistic Model](@ref). To better understand how to interact with the user interface and in particular the [`LikelihoodModel`](@ref), which holds all the information on computed profiles and predictions, check out the user interface starting with [Initialisation](@ref).
28+
29+
The API is largely stable, but shouldn't be regarded as fixed until the first version is released; the package will be kept as v1.0.0-DEV until then. The main work remaining is in completing documentation. However, one of the bivariate boundary methods may be removed.
30+
31+
A package developed to fulfil the requirements of a Masters of Engineering at The University of Auckland by Joel Trent between March 2023 and February 2024.
32+
33+
Supervised by Oliver Maclaren, Ruanui Nicholson and Matthew Simpson.
34+
35+
## Getting Started: Installation
36+
37+
To install the package, use the following command inside the Julia REPL. In the future this will be able to be installed directly rather than via the url.
38+
39+
```julia
40+
using Pkg
41+
Pkg.add(url="https://github.com/JoelTrent/LikelihoodBasedProfileWiseAnalysis.jl")
42+
```
43+
44+
To load the package, use the command:
45+
46+
```julia
47+
using LikelihoodBasedProfileWiseAnalysis
48+
```
49+
50+
## Alternatives for Likelihood-Based Uncertainty Quantification
51+
52+
If you are solely interested in parameter identifiability analysis and computing parameter confidence intervals we recommend [LikelihoodProfiler](https://insysbio.github.io/LikelihoodProfiler.jl/stable/), which is generally more stable and faster than the implementation in this package on the models we've tested.
53+
54+
[ProfileLikelihood](https://danielvandh.github.io/ProfileLikelihood.jl/stable/) is another excellent package which implements the PWA workflow from [simpsonprofilewise2023](@cite) - it has a different interface and its own set of heuristics for computing profiles.
55+
56+
[InformationGeometry](https://rafaelarutjunjan.github.io/InformationGeometry.jl/stable/) can compute the exact confidence regions/boundaries of models using differential geometry. It would be an interesting approach which could potentially evaluate confidence set boundaries more efficiently than the heuristics implemented in this package. Resultantly, its use within the PWA workflow may be worth investigating.

‎docs/src/quick_start.md

-5
This file was deleted.

‎docs/src/refs.bib

+49-30
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
@book{coleparameter2020,
2+
location = {New York},
3+
title = {Parameter Redundancy and Identifiability},
4+
isbn = {978-1-315-12000-3},
5+
pagetotal = {272},
6+
publisher = {Chapman and Hall/{CRC}},
7+
author = {Cole, Diana},
8+
year = {2020},
9+
url = {https://doi.org/10.1201/9781315120003},
10+
}
11+
12+
@article{murphyimplementing2023,
13+
title = {Implementing measurement error models in a likelihood-based framework for estimation, identifiability analysis, and prediction in the life sciences},
14+
author = {Murphy, Ryan J. and Maclaren, Oliver J. and Simpson, Matthew J.},
15+
doi = {10.48550/arXiv.2307.01539},
16+
year = {2023},
17+
journal = {arXiv:2307.01539}
18+
}
19+
20+
@book{pawitanall2001,
21+
title = {In All Likelihood: Statistical Modelling and Inference Using Likelihood},
22+
isbn = {978-0-19-850765-9},
23+
shorttitle = {In All Likelihood},
24+
pagetotal = {528},
25+
publisher = {Oxford University Press},
26+
author = {Pawitan, Yudi},
27+
year = {2001},
28+
}
29+
30+
@article{rauestructural2009,
31+
title = "{Structural and practical identifiability analysis of partially observed dynamical models by exploiting the profile likelihood}",
32+
volume = {25},
33+
url = {https://doi.org/10.1093/bioinformatics/btp358},
34+
pages = {1923-1929},
35+
number = {15},
36+
journal = {Bioinformatics},
37+
author = {Raue, A. and Kreutz, C. and Maiwald, T. and Bachmann, J. and Schilling, M. and Klingmüller, U. and Timmer, J.},
38+
year = {2009},
39+
}
40+
141
@article{simpsonprofilewise2023,
242
title = {Profile-Wise Analysis: A profile likelihood-based workflow for identifiability analysis, estimation, and prediction with mechanistic mathematical models},
343
volume = {19},
@@ -18,36 +58,15 @@ @article{simpsonprofile2023
1858
year = {2023},
1959
}
2060

21-
@article{rauestructural2009,
22-
title = "{Structural and practical identifiability analysis of partially observed dynamical models by exploiting the profile likelihood}",
23-
volume = {25},
24-
url = {https://doi.org/10.1093/bioinformatics/btp358},
25-
pages = {1923-1929},
26-
number = {15},
27-
journal = {Bioinformatics},
28-
author = {Raue, A. and Kreutz, C. and Maiwald, T. and Bachmann, J. and Schilling, M. and Klingmüller, U. and Timmer, J.},
29-
year = {2009},
30-
}
31-
32-
@book{pawitanall2001,
33-
title = {In All Likelihood: Statistical Modelling and Inference Using Likelihood},
34-
isbn = {978-0-19-850765-9},
35-
shorttitle = {In All Likelihood},
36-
pagetotal = {528},
37-
publisher = {Oxford University Press},
38-
author = {Pawitan, Yudi},
39-
year = {2001},
40-
}
41-
42-
@book{coleparameter2020,
43-
location = {New York},
44-
title = {Parameter Redundancy and Identifiability},
45-
isbn = {978-1-315-12000-3},
46-
pagetotal = {272},
47-
publisher = {Chapman and Hall/{CRC}},
48-
author = {Cole, Diana},
49-
year = {2020},
50-
url = {https://doi.org/10.1201/9781315120003},
61+
@article{simpsonreliable2022,
62+
title = {Reliable and efficient parameter estimation using approximate continuum limit descriptions of stochastic models},
63+
volume = {549},
64+
issn = {0022-5193},
65+
doi = {10.1016/j.jtbi.2022.111201},
66+
pages = {111201},
67+
journal = {Journal of Theoretical Biology},
68+
author = {Simpson, Matthew J. and Baker, Ruth E. and Buenzli, Pascal R. and Nicholson, Ruanui and Maclaren, Oliver J.},
69+
year = {2022}
5170
}
5271

5372
@article{viallefontparameter1998,

‎docs/src/user_interface/coverage/univariate_intervals.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Usage on several models can be seen in the examples section, such as for the [Lo
88

99
```@docs
1010
check_univariate_parameter_coverage
11-
```
11+
```

‎docs/src/user_interface/initialisation.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Initialisation
22

3-
```@index
4-
Pages = ["initialisation.md"]
5-
```
6-
73
## Model Initialisation
84

95
To initialise a model for profile likelihood evaluation we use [`initialise_LikelihoodModel`](@ref) which returns a struct of type [`LikelihoodModel`](@ref). This struct contains all the information we require for the PWA workflow and will also contain computed profiles and profile-wise predictions.
@@ -59,4 +55,10 @@ set_OptimizationSettings!
5955
OptimizationSettings
6056
optimise
6157
optimise_unbounded
58+
```
59+
60+
## Index
61+
62+
```@index
63+
Pages = ["initialisation.md"]
6264
```

‎docs/src/user_interface/plots.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Plots
22

3-
```@index
4-
Pages = ["plots.md"]
5-
```
6-
73
We provide functions for plotting univariate profiles, bivariate profiles and predictions of the model trajectory and ``(1-\delta)`` population reference set from evaluated parameter confidence sets (i.e. profiles).
84

95
## Univariate Profiles
@@ -28,4 +24,10 @@ plot_predictions_individual
2824
plot_predictions_union
2925
plot_realisations_individual
3026
plot_realisations_union
27+
```
28+
29+
## Index
30+
31+
```@index
32+
Pages = ["plots.md"]
3133
```

‎docs/src/user_interface/predictions.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Predictions
22

3-
```@index
4-
Pages = ["predictions.md"]
5-
```
6-
73
## Adding a Prediction Function
84

95
In the event that a prediction function has not been added to the [`LikelihoodModel`](@ref) struct yet, we can add one using [`add_prediction_function!`](@ref). This prediction function is for model solutions/trajectory and not the additional error we account for when predicting realisations.
@@ -53,4 +49,10 @@ Predictions are stored in a [`PredictionStruct`](@ref) which will also contain a
5349
AbstractPredictionStruct
5450
PredictionStruct
5551
PredictionRealisationsStruct
52+
```
53+
54+
## Index
55+
56+
```@index
57+
Pages = ["predictions.md"]
5658
```

‎docs/src/user_interface/profiles_and_samples/bivariate.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Bivariate Profiles
22

3-
```@index
4-
Pages = ["bivariate.md"]
5-
```
3+
The key function for evaluating bivariate profile boundaries is [`bivariate_confidenceprofiles!`](@ref). The evaluated bivariate profile(s) will be contained within a [`BivariateConfidenceStruct`](@ref) that is stored in the [`LikelihoodModel`](@ref).
64

75
```@docs
86
bivariate_confidenceprofiles!
@@ -40,9 +38,15 @@ MPPHullMethod
4038

4139
## Merging Boundaries From Multiple Methods
4240

43-
To improve the performance of internal point sampling, it may be worth finding bivariate boundaries using a combination of methods, where one method has more guaranteed boundary coverage and the other gives a more random search of interest parameter space, such as combining [`IterativeBoundaryMethod`](@ref) with [`SimultaneousMethod`](@ref) into a [`CombinedBivariateMethod`](@ref).
41+
To improve the performance of internal point sampling, it may be worth finding bivariate boundaries using a combination of methods, where one method has more guaranteed boundary coverage and the other gives a more random search of interest parameter space. For example, combining [`IterativeBoundaryMethod`](@ref) and [`SimultaneousMethod`](@ref) into a [`CombinedBivariateMethod`](@ref).
4442

4543
```@docs
4644
CombinedBivariateMethod
4745
combine_bivariate_boundaries!
46+
```
47+
48+
## Index
49+
50+
```@index
51+
Pages = ["bivariate.md"]
4852
```
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# Dimensional Samples
22

3-
```@index
4-
Pages = ["dimensional.md"]
5-
```
6-
73
We can generate samples within the log-likelihood boundary at any dimension of model interest parameters. Nuisance parameters will be set to the values that maximise the log-likelihood function, found using an optimisation scheme. Samples are only implemented for the true log-likelihood function (the [`LogLikelihood`](@ref) profile type).
84

95
## Sample Types
106

7+
Three methods are implemented for rejection sampling of parameter confidence sets within the supplied parameter bounds. These will be inefficient if the bounds are not well-specified (are not close to the boundary of the desired parameter confidence set), and as both the model parameter dimension increases and the interest parameter dimension of the profile increases. By default these are the bounds contained with [`CoreLikelihoodModel`](@ref), however, seperate bounds can be supplied for the purposes of sampling. Uniform grid sampling, uniform random sampling and sampling from a random Latin Hypercube scheme (the default) are supported.
8+
119
```@docs
1210
AbstractSampleType
1311
UniformGridSamples
@@ -17,14 +15,24 @@ LatinHypercubeSamples
1715

1816
## Full Likelihood Sampling
1917

18+
To sample a confidence set for the full parameter vector, a full parameter confidence set, we use [`full_likelihood_sample!`](@ref). The sampled confidence set will be contained within a [`SampledConfidenceStruct`](@ref) that is stored in the [`LikelihoodModel`](@ref).
19+
2020
```@docs
2121
full_likelihood_sample!
2222
```
2323

2424
## Dimensional Likelihood Sampling
2525

26-
Note: dimensional likelihood samples can be 'full' likelihood samples as well.
26+
Similarly, to sample a confidence set for an interest subset of the parameter vector, a 'dimensional profile', we use [`dimensional_likelihood_samples!`](@ref). The sampled confidence set(s) will be contained within a [`SampledConfidenceStruct`](@ref) that is stored in the [`LikelihoodModel`](@ref).
27+
28+
Note: dimensional likelihood samples can be 'full' likelihood samples as well. These will be computed before any other dimensional samples.
2729

2830
```@docs
2931
dimensional_likelihood_samples!
32+
```
33+
34+
## Index
35+
36+
```@index
37+
Pages = ["dimensional.md"]
3038
```

‎docs/src/user_interface/profiles_and_samples/profile_structs.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# Structs and Profile Types
22

3-
```@index
4-
Pages = ["profile_structs.md"]
5-
```
6-
73
## Structs
84

5+
The following structs are used to contain information on computed univariate, bivariate and sampled dimensional profiles. After evaluation they are stored in the [`LikelihoodModel`](@ref).
6+
97
```@docs
108
PointsAndLogLikelihood
119
AbstractConfidenceStruct
@@ -24,4 +22,10 @@ AbstractEllipseProfileType
2422
LogLikelihood
2523
EllipseApprox
2624
EllipseApproxAnalytical
25+
```
26+
27+
## Index
28+
29+
```@index
30+
Pages = ["profile_structs.md"]
2731
```
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Univariate Profiles
22

3-
```@index
4-
Pages = ["univariate.md"]
5-
```
3+
The key function for evaluating univariate profiles (the parameter confidence interval and corresponding points along the profile as desired) is [`univariate_confidenceintervals!`](@ref). The evaluated univariate profile(s) will be contained within a [`UnivariateConfidenceStruct`](@ref) that is stored in the [`LikelihoodModel`](@ref).
64

75
```@docs
86
univariate_confidenceintervals!
97
get_points_in_intervals!
108
get_uni_confidence_interval
119
get_uni_confidence_interval_points
10+
```
11+
12+
## Index
13+
14+
```@index
15+
Pages = ["univariate.md"]
1216
```

‎docs/src/workflow_background.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Workflow Background
2+
3+
Here we cover the background / general idea of the PWA workflow as seen in [simpsonprofilewise2023](@cite). We also introduce the idea of reference tolerance sets for predictions of realisations/observations within the workflow as introduced in my [Masters thesis](https://github.com/JoelTrent/UoA_MastersWorking).
4+
5+
This is a summary of the content in my [Masters thesis](https://github.com/JoelTrent/UoA_MastersWorking).
6+
7+
This summary uses models of the form 'deterministic mathematical model + error model' as in [simpsonprofilewise2023](@cite) and [murphyimplementing2023](@cite), but it can also be used with stochastic models [simpsonreliable2022](@cite).
8+

‎src/model_initialiser.jl

+7
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ Initialises a [`LikelihoodModel`](@ref) struct, which contains all model informa
191191
- `dim_row_preallocation_size`: number of rows of `dim_samples_df` to preallocate. Default is `missing` (a single row).
192192
- `find_zero_atol`: a `Real` number greater than zero for the absolute tolerance of the log-likelihood function value from the target value to be used when searching for confidence intervals/boundaries. Default is `0.001`.
193193
- `show_progress`: Whether to show the progress of profiling and predictions.
194+
195+
!!! note "Array initialisation within a log-likelihood function"
196+
If you initialise an array within the provided log-likelihood function, e.g. using `zeros`, then for automatic differentiation methods to work you need to also initialise the type of the array to be based on the type of the input values of θ. Otherwise, zeros will by default create an array with element types `Float64` which will likely return errors. For example, use:
197+
```julia
198+
my_new_array = zeros(eltype(θ), dimensions)
199+
```
200+
where `eltype` passes the element type of the θ vector into the `zeros` function.
194201
"""
195202
function initialise_LikelihoodModel(loglikefunction::Function,
196203
predictfunction::Union{Function, Missing},

0 commit comments

Comments
 (0)
Please sign in to comment.