Skip to content

Instantly share code, notes, and snippets.

@jzstark
Last active July 4, 2017 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jzstark/001195b5fbb58aa26d9d227e2403bd5e to your computer and use it in GitHub Desktop.
Save jzstark/001195b5fbb58aa26d9d227e2403bd5e to your computer and use it in GitHub Desktop.
Probability Plot
(*A good example*)
let y = Mat.(gaussian 100 1 *$ 10.) in
let h = create "" in
let _ = set_background_color h 28 28 28 in
let _ = set_title h "Gaussian Data to fit Weibull Dist" in
let _ = set_xlabel h "Sample Data" in
let _ = set_ylabel h "Theoratical Weibull Distribution invCdf" in
let _ = probplot ~h ~dist:(fun i -> Owl_stats.Cdf.weibull_Pinv i 1. 1.) y in
output h;;
(* Now this example will also work! *)
let y = Mat.(gaussian 100 1 *$ 10.) in
probplot ~dist:(fun i -> Owl_stats.Cdf.weibull_Pinv i 1. 1.) y
(* TODO: change y axis tick labels *)
let ticks_perc = [1.; 5.; 10.; 20.; 50.; 80.; 90.; 95.; 99.] in
let ps = List.map (fun i -> i /. 100.) ticks_perc in
let ticks_quan = List.map norminv ps in
let ticks_perc = List.map string_of_float ticks_perc in
let yticks = List.combine ticks_quan ticks_perc in
set_yticklabels h yticks
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment