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

    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<float,float>
val dataset: CodedMap<Time.TimeSeries<float>>
val hypothesis: ModelSystem.ModelSystem
val result: ModelSystem.EstimationResult
val fitFn: (EstimationEngine.EstimationEngine<float,float> -> EstimationEngine.EndCondition<float> -> CodedMap<Time.TimeSeries<float>> -> ModelSystem.ModelSystem -> ModelSystem.EstimationResult)
val fit: engine: EstimationEngine.EstimationEngine<float,float> -> endCondition: EstimationEngine.EndCondition<float> -> timeSeriesData: CodedMap<Time.TimeSeries<float>> -> model: ModelSystem.ModelSystem -> ModelSystem.EstimationResult
<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
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<float,'a> -> EstimationEngine.EndCondition<float> -> 'b -> ModelSystem.ModelSystem -> ModelSystem.EstimationResult) -> engine: EstimationEngine.EstimationEngine<float,'a> -> subject: 'b -> hypothesis: ModelSystem.ModelSystem -> n: int -> result: ModelSystem.EstimationResult -> 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.