Commit b041a8e1 authored by Philippe Veber's avatar Philippe Veber
Browse files

notes/multinomial_null: fixed tdg09 run

parent 70f7f82d
......@@ -172,12 +172,10 @@ Then how to implement a uniformity test under tdg09's null :
```ocaml
let tdg09_uniformity_test ?alpha tree f =
Show.cached_png_rplot (fun%workflow () ->
let sites = tdg09_simulation ?alpha tree 1_000 in
Array.map sites ~f
|> OCamlR_graphics.hist ~breaks:(`n 60)
|> fun _ -> ()
)
let sites = tdg09_simulation ?alpha tree 1_000 in
Array.map sites ~f
|> OCamlR_graphics.hist ~breaks:(`n 60)
|> fun _ -> ()
;;
```
......@@ -218,16 +216,22 @@ let multinomial_on_tdg09_simulation site =
And we're ready to go :
```ocaml
let tree = load_tree tree_path in
tdg09_uniformity_test tree multinomial_on_tdg09_simulation;;
Show.cached_png_rplot (fun%workflow () ->
let tree = load_tree tree_path in
tdg09_uniformity_test tree multinomial_on_tdg09_simulation
);;
```
This is far from uniform, and to be honest no surprise here:
uniformity is expected when the data is generated under the null *of
the test*. Here we are working under a different model.
the test*.
## Tdg09 under its null hypothesis
Just to be sure everything is working as expected, we can also ask if
tdg09 behaves when used under its null.
Here is the code to apply tdg09 on a simulation:
```ocaml
let tdg09_on_tdg09_simulation tree sim =
......@@ -238,7 +242,19 @@ let tdg09_on_tdg09_simulation tree sim =
;;
```
And we test it on the same simulation settings:
```ocaml
let tree = load_tree tree_path in
tdg09_uniformity_test tree (tdg09_on_tdg09_simulation tree);;
Show.cached_png_rplot (fun%workflow () ->
let tree = load_tree tree_path in
tdg09_uniformity_test tree (tdg09_on_tdg09_simulation tree)
);;
```
The resulting distribution is not exactly uniform, but at least there
is no accumulation near 0. The accumulation around 1 certainly
correspond to cases where the optimization could not obtain a better
likelihood with the full model than with the reduced one. Another
major reason for no strict uniformity is that the likelihood ratio
used in the method is only asymptotically valid, and here the sample
size is only 1.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment