Model Selection - Clinical Trial

(See file Samples\Fun\ClinicalTrial\ClinicalTrial.fs.)

Sometimes the choice of the distribution of a random variable may depend on another random variable, thus creating a mixture model. In Infer.NET Fun mixture models correspond to if-expressions. We show how to rewrite the clinical trial example of Infer.NET using Infer.NET Fun. We use the same data as the Infer.NET example, the indication of whether treatment has been effective in a group that received an experimental drug and in a control group that received placebo instead:

let controlGroup = [|falsefalsetruefalsefalse|]
let treatedGroup = [|truefalsetruetruetrue|]

We are interested in the probability that the drug is effective, and in the treatment effectiveness in each of the groups. Their relationship is described as follows:

    let isEffective = random(Bernoulli(0.5))
    let probIfTreated, probIfControl = 
      if isEffective then
        (random(Beta(1.0, 1.0)), random(Beta(1.0, 1.0)))
        let p = random(Beta(1.0, 1.0)) in (p, p)

    observe(controlGroup = [|for c in controlGroup -> random(Bernoulli(probIfControl))|])
    observe(treatedGroup = [|for c in treatedGroup -> random(Bernoulli(probIfTreated))|])

    isEffective, probIfTreated, probIfControl

This models the overall effectiveness of the drug. We are also interested in the actual effectiveness in the treated and the control groups, given that the drug is effective. Therefore we call inference the second time, this time adding an observation:

    probIfTreated, probIfControl
©2009-2013 Microsoft Corporation. All rights reserved.  Terms of Use | Trademarks | Privacy Statement