|
#
# This example taken from
# http://amca01.wordpress.com/2012/05/29/a-piecewise-polynomial-approximation-to-the-normal-cdf/
# Original approximation from John Hoyt (1962), The American Statistician 22:25-26.
#
set termopt enhanced; show term
set termopt dash;
save_encoding = GPVAL_ENCODING; set encoding utf8
set title "Piecewise approximation to the\nNormal Cumulative Distribution Function"
set format "%.1f"
set key left Left reverse invert
set style data lines
set xtics nomirror
set xrange [ 0 : 4 ]
set yrange [ 0.5 : 1.1 ]
set style line 1 lt 0 lw 3
set style line 2 lt 0 lw 3 lc rgb "red"
part1(x) = 0.5 + (9.*x-x**3)/ 24.
part2(x) = 1.0 + (x-3.0)**3 / 48.
part1 = "part1: for x < 1 norm(x) ≈ ½ + (9x-x^3) / 24"
part2 = "part2: for x > 1 norm(x) ≈ 1 + (x-3)^3 / 48"
set label 1 at 1.0, 0.62
set label 1 "plot norm(x), [0:1] part1(x), [1:4] part2(x)"
set arrow 1 from 1.,.7 to 1.,.9 nohead
plot norm(x) lt -1, \
[1:4] part2(x) ls 2 title part2, \
[0:1] part1(x) ls 1 title part1
Click here for minimal script to generate this plot
|