Deming's funnel: Difference between revisions
tweak plot display
m (label plots) |
(tweak plot display) |
||
Line 561:
<lang julia># Run from Julia REPL to see the plots.
using Statistics, Distributions, Plots
const racket_xdata = [-0.533, 0.270, 0.859, -0.043, -0.205, -0.127, -0.071, 0.275, 1.251, -0.231,
-0.401, 0.269, 0.491, 0.951, 1.150, 0.001, -0.382, 0.161, 0.915, 2.080, -2.337,
Line 572:
-0.289, 0.521, 0.017, 0.281, -0.749, -0.149, -2.436, -0.909, 0.394, -0.113, -0.598,
0.443, -0.521, -0.799, 0.087]
const racket_ydata = [0.136, 0.717, 0.459, -0.225, 1.392, 0.385, 0.121, -0.395, 0.490, -0.682, -0.065,
0.242, -0.288, 0.658, 0.459, 0.000, 0.426, 0.205, -0.765, -2.188, -0.742, -0.010,
Line 582:
0.721, 0.104, -0.729, 0.650, -1.103, 0.154, -1.720, 0.051, -0.385, 0.477, 1.537,
-0.901, 0.939, -0.411, 0.341, -0.411, 0.106, 0.224, -0.947, -1.424, -0.542, -1.032]
const rules = [(x, y, dx, dy) -> [0, 0], (x, y, dx, dy) -> [-dx, -dy],
(x, y, dx, dy) -> [-x - dx, -y - dy], (x, y, dx, dy) -> [x + dx, y + dy]]
const plots, colors =
function makedata()
radius_angles = zip(rand(Normal(), 100), rand(Uniform(-π, π), 100))
zip([z[1] * cos(z[2]) for z in radius_angles], [z[1] * sin(z[2]) for z in radius_angles])
end
function testfunnel(useracket=true)
for (i, rule) in enumerate(rules)
Line 604:
println("mean x: ", round(mean(xvec), digits=4), " std x: ", round(std(xvec, corrected=false), digits=4),
" mean y: ", round(mean(yvec), digits=4), " std y: ", round(std(yvec, corrected=false), digits=4))
title= useracket ? "Racket Data" : "Random Data", label="Rule $i")
end
end
println("\nUsing Racket data.")
testfunnel()
println("\nUsing new data.")
testfunnel(false)
display(plots)
</lang>{{out}}
<pre>
|