Commit 437cf2e3 authored by Philippe Veber's avatar Philippe Veber
Browse files

notes/calibration: changed representation for calibration under null

parent 487f8876
......@@ -216,7 +216,8 @@ let uniformity_test ?(alpha = 10.) ?(filter_out_single_category = false) ~k ~n1
loop ()
)
in
ignore (OCamlR_graphics.hist ~breaks:(`n 20) p_values : OCamlR_graphics.hist)
let ecdf = OCamlR_stats.Ecdf.make (OCamlR_base.Numeric.of_array p_values) in
OCamlR_stats.Ecdf.plot ~main:"" ~xlab:"p" ecdf
let example = {
k = 20 ;
......
......@@ -64,17 +64,18 @@ let hist_pval (convergence_table : cpt file) (pvalue_column:string): pdf file =
in
Bistro.Workflow.path_plugin ~descr:"Calibration.hist_pval" f
(* let quantiles_pval convergence_table pvalue_column =
let module R = Bistro_utils.R_script in
let f = fun%workflow dest ->
let pvals = pvals_of_cpt [%path convergence_table] pvalue_column
|> Array.to_list in
[%script {|
library(tidyverse)
pvals = <<< R.(make [floats pvals]) >>>
|}] in
let script = Workflow.path_plugin ~descr:"calibration.quantiles_pval_script" f in
R.workflow ~descr:"calibration.quantiles_pval" f *)
let pval_ecdf (convergence_table : cpt file) (pvalue_column:string): pdf file =
let f = fun%workflow dest ->
let pvals =
pvals_of_cpt [%path convergence_table] pvalue_column
|> OCamlR_base.Numeric.of_array
in
OCamlR_grDevices.pdf dest;
OCamlR_stats.Ecdf.(plot (make pvals)) ;
OCamlR_graphics.abline ~a:0. ~b:1. () ;
OCamlR_grDevices.dev_off ()
in
Bistro.Workflow.path_plugin ~descr:"Calibration.pval_ecdf" f
module Under_mutsel = struct
module Pipeline = Codepi.Simulation_pipeline.Mutsel
......@@ -124,7 +125,7 @@ module Under_mutsel = struct
let inhouse_tdg09 dataset =
query dataset
|> Pipeline.inhouse_tdg09
|> Fn.flip hist_pval "inhouse_tdg09_1mpval"
|> Fn.flip pval_ecdf "inhouse_tdg09_1mpval"
let query_benchmark ?(seed = 42) ?(cpg_hypermutability = false) ?(gBGC = false) { tree = t ; ne_s ; branch_scale ; _ } =
let rate_CpG = if cpg_hypermutability then Some 10. else None in
......@@ -242,16 +243,21 @@ module Under_tdg09 = struct
in
let sites = simulation ~rng ?alpha wag tree 1_000 in
OCamlR_grDevices.pdf dest ;
Array.map sites ~f
|> OCamlR_graphics.hist ~breaks:(`n 60)
|> fun _ -> OCamlR_grDevices.dev_off ()
let pvals =
Array.map sites ~f
|> OCamlR_base.Numeric.of_array
in
OCamlR_grDevices.pdf dest;
OCamlR_stats.Ecdf.(plot (make pvals) ~xlab:"p") ;
OCamlR_graphics.abline ~a:0. ~b:1. ~col:"grey" () ;
OCamlR_grDevices.dev_off ()
in
Workflow.path_plugin ~descr:"tdg09_uniformity_test" f
end
let target () =
let tree = Workflow.input "data/besnard2009/besnard2009.nhx" in
let _multinomial_under_tdg09 = Under_tdg09.uniformity_test tree `Multinomial in
let multinomial_under_tdg09 = Under_tdg09.uniformity_test tree `Multinomial in
let tdg09_under_tdg09 = Under_tdg09.uniformity_test tree `Tdg09 in
let lmm_under_mutsel_besnard2009 = Under_mutsel.lmm besnard2009 in
let multinomial_under_mutsel_besnard2009 = Under_mutsel.multinomial besnard2009 in
......
......@@ -21,6 +21,10 @@
%multinomial under its null
% for each topology
\begin{frame}{Multinomial under tdg09 simulations}
\includegraphics[width=0.75\textwidth]{<<<Report.pdfdep multinomial_under_tdg09>>>}
\end{frame}
\begin{frame}{Tdg09@LBBE under tdg09 simulations}
\includegraphics[width=0.75\textwidth]{<<<Report.pdfdep tdg09_under_tdg09>>>}
\end{frame}
......
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