Header menu logo bristlecone

Calculating Confidence Intervals

Bristlecone includes functions to calculate confidence intervals based on a profile likelihood method. Given the minimum -log likelihood, the profile likelihood method samples the parameter space around this point. The range sampled for each parameter is discovered at 95% and 68% confidence based on a chi squared distribution.

These functions are included in the Bristlecone.Optimisation.ConfidenceInterval module. An example of their use is given below:

open Bristlecone
open Bristlecone.Optimisation
open Bristlecone.Data

fun engine dataset hypothesis result ->

    // The function used to fit the model, which unless an
    // advanced scenario is usually Bristlecone.fit
    let fitFn = Bristlecone.fit

    // The number of jumps to perform in parameter space
    let n = 10000<iteration>

    let ci =
        Confidence.ProfileLikelihood.profile fitFn engine dataset hypothesis n result

    // Optionally, save the result
    let saveDir = "/some/save/dir"
    let subjectName = "some subject"
    let modelId = "some model hypothesis"
    Confidence.save saveDir subjectName modelId result.ResultId ci
Multiple items
module Bristlecone from Bristlecone
<namespacedoc><summary>The core library of Bristlecone, containing model-fitting functions.</summary></namespacedoc>
Main functionality of Bristlecone, including functions to scaffold `ModelSystem`s and for model-fitting (tests and real fits).


--------------------
namespace Bristlecone
namespace Bristlecone.Optimisation
namespace Bristlecone.Data
val engine: EstimationEngine.EstimationEngine<'a,'b,'u,'v> (requires comparison and comparison)
val dataset: CodedMap<Time.TimeSeries<float<'v>,'a,'c,'b>> (requires comparison and comparison)
val hypothesis: ModelSystem.ModelSystem<'u>
val result: ModelSystem.EstimationResult<'d,'e,'f>
val fitFn: (EstimationEngine.EstimationEngine<'g,'h,'w,'x> -> EstimationEngine.EndCondition -> CodedMap<Time.TimeSeries<float<'x>,'g,'i,'h>> -> ModelSystem.ModelSystem<'w> -> ModelSystem.EstimationResult<'g,'i,'h>) (requires comparison and comparison)
val fit: engine: EstimationEngine.EstimationEngine<'a,'b,'modelTimeUnit,'u> -> endCondition: EstimationEngine.EndCondition -> timeSeriesData: CodedMap<Time.TimeSeries<float<'u>,'a,'c,'b>> -> model: ModelSystem.ModelSystem<'modelTimeUnit> -> ModelSystem.EstimationResult<'a,'c,'b> (requires comparison and comparison)
<summary>Fit a time-series model to data.</summary>
<param name="engine">An estimation engine configured and tested for the given model.</param>
<param name="endCondition">The condition at which optimisation should cease.</param>
<param name="timeSeriesData">Time-series dataset that contains a series for each equation in the model system.</param>
<param name="model">A model system of equations, likelihood function, estimatible parameters, and optional measures.</param>
<returns>The result of the model-fitting procedure. If an error occurs, throws an exception.</returns>
val n: int<iteration>
[<Measure>] type iteration
val ci: Map<ShortCode.ShortCode,Confidence.ConfidenceInterval>
Multiple items
module Confidence from Bristlecone.Data

--------------------
namespace Bristlecone.Confidence
module ProfileLikelihood from Bristlecone.Confidence
<summary>Given a maximum likelihood estimate (MLE), the profile likelihood method runs a Monte Carlo algorithm that samples around the MLE.</summary>
<remarks>The range for each parameter is discovered at 95% and 68% confidence based on a chi squared distribution.</remarks>
val profile: fit: (EstimationEngine.EstimationEngine<'a,'b,'u,'v> -> EstimationEngine.EndCondition -> 'c -> ModelSystem.ModelSystem<'modelTimeUnit> -> ModelSystem.EstimationResult<'d,'e,'f>) -> engine: EstimationEngine.EstimationEngine<'a,'b,'u,'v> -> subject: 'c -> hypothesis: ModelSystem.ModelSystem<'modelTimeUnit> -> n: int<iteration> -> result: ModelSystem.EstimationResult<'g,'h,'i> -> Map<ShortCode.ShortCode,Confidence.ConfidenceInterval>
<summary> The profile likelihood method samples the likelihood space around the Maximum Likelihood Estimate </summary>
val saveDir: string
val subjectName: string
val modelId: string
val save: directory: string -> subject: string -> modelId: string -> runId: System.Guid -> result: CodedMap<Confidence.ConfidenceInterval> -> unit
ModelSystem.EstimationResult.ResultId: System.Guid

Type something to start searching.