1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
|
#set term postscript eps enhanced
set term pstex monochrome
set samples 300
#set size 0.8,0.88 # paperback 6x9 #CHANGE THESE LATER IN FILE ALSO
set size 1,1.1 # us letter #IF MODIFIED
set border 31 lw 0.5
set tics out
set ticscale 0.5 0.25
set xtics border nomirror norotate
set ytics border nomirror norotate
set format x "%g"
# Continuous distributions
set xlabel "$x$"
set ylabel "$p(x)$"
set xrange [-5:5]
set yrange [0:0.5]
set ytics 0.1
set xtics 1
set output "rand-gaussian.tex"
set title "Gaussian Distribution"
p(x)=1/sqrt(2*pi*sigma**2)*exp(-x**2/(2*sigma**2))
plot sigma=1.0, p(x) title "$\\sigma=1$", \
sigma=2.0, p(x) title "$\\sigma=2$"
set xrange [0:5]
set yrange [0:2]
set ytics 0.5
set xtics 1
set output "rand-gaussian-tail.tex"
set title "Gaussian Tail Distribution"
p(x)= x > a ? 1/(0.5*erfc(a/sqrt(2*sigma**2))*sqrt(2*pi*sigma**2))*exp(-x**2/(2*sigma**2)) : 0
plot a=1.5, sigma=1.0, p(x) title "$\\sigma=1,a=1.5$"
set xrange [0:5]
set yrange [0:1.09]
set ytics 0.5
set xtics 1
set output "rand-rayleigh-tail.tex"
set title "Rayleigh Tail Distribution"
p(x)= x > a ? (x/sigma**2)*exp((a**2 - x**2)/(2*sigma**2)) : 0
plot a=1.0, sigma=1.0, p(x) title "$a=1,\\sigma=1$", \
a=0.5, sigma=2.0, p(x) title "$a=0.5,\\sigma=2$"
set size ratio -1 0.8,1.143
set xlabel "$x$"
set ylabel "$y$"
set xrange [-2:2]
set yrange [-2:2]
set ytics 1
set xtics 1
set output "rand-bivariate-gaussian.tex"
set title "Bivariate Gaussian Distribution"
set isosamples 30
p(x,y)=1/sqrt(2*pi*sqrt(1-rho**2))*exp(-(x**2 + y**2 - 2*rho*x*y)/(2*(1-rho**2)))
#set cntrparam cspline
set noclabel
set contour
set view map
set nosurface
splot rho=0.9, p(x,y) title "$\\sigma_x=1, \\sigma_y=1, \\rho=0.9$"
set size noratio 1,1.1 # us letter
set xlabel "$x$"
set ylabel "$p(x)$"
set ytics 0.1
set xrange [-5:5]
set yrange [0:0.4]
set output "rand-cauchy.tex"
set title "Cauchy Distribution"
p(x)=1/(pi*a*(1+(x/a)**2))
plot a=1.0, p(x) title "$a=1$", \
a=2.0, p(x) title "$a=2$"
set ytics 0.5
set yrange [0:1]
set xrange [0:3]
set output "rand-exponential.tex"
set title "Exponential Distribution"
p(x)=exp(-x/mu)/mu
plot mu=1.0, p(x) title "$\\mu=1$", \
mu=2.0, p(x) title "$\\mu=2$"
set yrange [0:1]
set xrange [0:3]
set output "rand-chisq.tex"
set title "Chi-squared Distribution"
p(x)=(x/2)**(nu/2.0-1.0) *exp(-x/2)/ (2*gamma(nu/2.0))
plot nu=1.0, p(x) title "$\\nu=1$", \
nu=2.0, p(x) title "$\\nu=2$", \
nu=3.0, p(x) title "$\\nu=3$"
set yrange [0:1]
set xrange [0:5]
set output "rand-erlang.tex"
set title "Erlang Distribution"
p(x)=x**(n-1) *exp(-x/a)/ (gamma(n)*a**n)
plot n=1.0, a=1, p(x) title "$n=1$", \
n=2.0, a=1.0, p(x) title "$n=2$", \
n=3.0, a=1.0, p(x) title "$n=3$"
set xrange [0:2]
set xtics 1
set output "rand-fdist.tex"
set title "F-Distribution"
p(x)=gamma((v1+v2)/2.0)*v1**(v1/2.0)*v2**(v2/2.0)\
/gamma(v1/2.0)/gamma(v2/2.0) * \
x**(v1/2.0-1)*(v2+v1*x)**-(v1/2.0+v2/2.0)
plot v1=1.0, v2=1.0, p(x) title "$\\nu_1=1, \\nu_2=1$", \
v1=3.0, v2=1.0, p(x) title "$\\nu_1=3, \\nu_2=2$"
set xrange [0:5]
set output "rand-flat.tex"
set title "Flat Distribution"
p(x)= (x<b && x>a) ? 1/(b-a) : 0
plot a=0.5, b=2.5, p(x) title "$a=0.5,b=2.5$" with step, \
a=1.2, b=4.8, p(x) title "$a=1.2,b=4.8$" with step
set xrange [0:5]
set yrange [0:1]
set ytics 0.5
set output "rand-gamma.tex"
set title "Gamma Distribution"
p(x)= x**(a-1)* exp(-x) / gamma(a)
plot a=1.0, p(x) title "$a=1$", \
a=2.0, p(x) title "$a=2$", \
a=3.0, p(x) title "$a=3$"
set xrange [0:1]
set yrange [0:4]
set xtics 0.25
set ytics 1
set output "rand-beta.tex"
set title "Beta Distribution"
p(x)= gamma(a+b)/(gamma(a)*gamma(b))*x**(a-1)*(1-x)**(b-1)
plot a=2.0, b=2.0, p(x) title "$a=2,b=2$", \
a=4.0, b=1.0, p(x) title "$a=4,b=1$", \
a=1.0, b=4.0, p(x) title "$a=1,b=4$"
set xrange [-5:5]
set yrange [0:0.3]
set ytics 0.1
set xtics 1
set output "rand-logistic.tex"
set title "Logistic Distribution"
p(x)= exp(-x/a)/a/(1+exp(-x/a))**2
plot a=1.0, p(x) title "$a=1$", \
a=2.0, p(x) title "$a=2$"
set xrange [0:3]
set yrange [0:0.7]
set xtics 1
set ytics 0.5
set output "rand-lognormal.tex"
set title "Lognormal Distribution"
p(x)= exp(-(log(x)-zeta)**2/2/sigma**2)/sqrt(2*pi*sigma**2)/x
plot zeta=0.0, sigma=1.0, p(x) title "$\\zeta=0, \\sigma=1$", \
zeta=1.0, sigma=1.0, p(x) title "$\\zeta=1, \\sigma=1$"
set xrange [0:5]
set yrange [0:2]
set ytics 0.5
set xtics 1
set output "rand-pareto.tex"
set title "Pareto Distribution"
p(x)= x>b ? a*b**a/x**(a+1) : 0
plot a=1.0, b=1, p(x) title "$a=1, b=1$", \
a=3.0, b=2, p(x) title "$a=3, b=2 $"
set xrange [0:5]
set yrange [0:0.7]
set ytics 0.1
set xtics 1
set output "rand-rayleigh.tex"
set title "Rayleigh Distribution"
p(x)= (x/sigma**2)*exp(-x**2/(2*sigma**2))
plot sigma=1.0, p(x) title "$\\sigma=1$", \
sigma=2.0, p(x) title "$\\sigma=2$"
set xrange [0:5]
set yrange [0:1.09]
set ytics 0.5
set xtics 1
set output "rand-rayleigh-tail.tex"
set title "Rayleigh Tail Distribution"
p(x)= x > a ? (x/sigma**2)*exp((a**2 - x**2)/(2*sigma**2)) : 0
plot a=1.0, sigma=1.0, p(x) title "$a=1,\\sigma=1$", \
a=0.5, sigma=2.0, p(x) title "$a=0.5,\\sigma=2$"
set xrange [-4:4]
set yrange [0:0.5]
set ytics 0.1
set output "rand-tdist.tex"
set title "Student's t distribution"
p(x)=gamma((v+1.0)/2)/sqrt(pi*v)/gamma(v/2)*(1+(x**2)/v)**-((v+1.0)/2)
plot v=1.0, p(x) title "$\\nu_1=1$", \
v=5.0, p(x) title "$\\nu_1=5$"
set xrange [-5:5]
set yrange [0:0.55]
set ytics 0.1
set output "rand-laplace.tex"
set title "Laplace Distribution (Two-sided Exponential)"
p(x)=exp(-abs(x)/a)/2/a
plot a=1.0, p(x) title "$a=1$", \
a=2.0, p(x) title "$a=2$"
set xrange [-5:5]
set yrange [0:0.8]
set ytics 0.2
set output "rand-exppow.tex"
set title "Exponential Power Distribution"
p(x)=exp(-(abs(x/a))**b)/2/a/gamma(1.0+1.0/b)
plot a=1.0, b=2.5, p(x) title "$a=1, b=2.5$", \
a=1.0, b=0.5, p(x) title "$a=1, b=0.5$"
set xrange [-5:10]
set yrange [0:0.2]
set ytics 0.1
set output "rand-landau.tex"
set title "Landau Distribution"
plot 'landau.dat' notitle w lines
set xrange [-5:5]
set yrange [0:0.45]
set ytics 0.1
set output "rand-levy.tex"
set title "Levy Distribution"
p1(x)=1/(pi*mu*(1+(x/mu)**2))
p2(x)=1/sqrt(2*pi*2*mu**2)*exp(-x**2/(4*mu**2))
plot mu=1.0, a=1, p1(x) title "$c=1, \\alpha=1.0$", \
mu=1.0, a=2, p2(x) title "$c=1, \\alpha=2.0$"
set xrange [-5:5]
set yrange [0:0.35]
set ytics 0.05
set output "rand-levyskew.tex"
set title "Levy Skew Distribution"
logp(x)= -1.34229+x*(-0.354314+x*(-0.322538+x*(0.205603+x*(-0.0518879+x*(0.00569502+x*-0.000224843)))))
p1(x)=exp(logp(x))
plot mu=1.0, a=1, p1(x) title "$c=1, \\alpha=1.0, \\beta=1.0$"
set xrange [0:2]
set yrange [0:1.5]
set ytics 0.5
set xtics 0.5
set output "rand-weibull.tex"
set title "Weibull Distribution"
p(x)=(b/a) * (x/a)**(b-1) * exp(-(x/a)**b)
plot a=1.0, b=1.0, p(x) title "$a=1,b=1$", \
a=1.0, b=2.0, p(x) title "$a=1,b=2$", \
a=2.0, b=3.0, p(x) title "$a=2,b=3$"
set xrange [-2:5]
set yrange [0:0.5]
set ytics 0.1
set xtics 1.0
set output "rand-gumbel1.tex"
set title "Type 1 Gumbel Distribution"
p1(x)=a*b*exp(-(b*exp(-a*x)+a*x))
plot a=1.0, b=1.0, p1(x) title "Type 1, $a=1,b=1$"
set xrange [0:2]
set yrange [0:0.7]
set ytics 0.1
set xtics 0.5
set output "rand-gumbel2.tex"
set title "Type 2 Gumbel Distribution"
p2(x)=x > 0 ? a*b*x**(-a-1)*exp(-b*x**-a) : 0
plot a=1.0, b=1.0, p2(x) title "Type 2, $a=1,b=1$"
# Discrete distributions
set xlabel "$k$"
set ylabel "$p(k)$"
set ticscale 0.5 1
set mxtics 2
set xrange [-0.5:10.5]
set yrange [0:0.3]
set ytics 0.1
set xtics 1
set function style step
set output "rand-poisson.tex"
set title "Poisson Distribution"
p(x)=mu**int(x)/(int(x)!) * exp(-mu)
plot mu=2.5, p(x+0.5) title "$\\mu=2.5$"
set xrange [:1.5]
set yrange [0:1]
set ytics 0.5
set xtics 1
set function style step
set output "rand-bernoulli.tex"
set title "Bernoulli Trial"
p(x)= (int(x) == 0) ? 1-p : p
plot p = 0.7, p(x+0.5) title "$p=0.7$"
set xrange [:10.5]
set yrange [0:0.3]
set xtics 1
set ytics 0.1
set output "rand-binomial.tex"
set title "Binomial Distribution"
p(x)= P**int(x)*(1-P)**(n-int(x))*gamma(n+1.0)/gamma(int(x)+1.0)/gamma(n-int(x)+1.0) + 1e-5
plot P=0.5,n=9.99999999, p(x+0.5) title "$p=0.5,n=9$"
set xrange [:5.5]
set yrange [0:0.7]
set ytics 0.1
set xtics 1
set output "rand-geometric.tex"
set title "Geometric Distribution"
p(x)=int(x) ? P*(1-P)**int(x-1) : 0
plot P=0.5, p(x+0.5) title "$p=0.5$"
set xrange [:10.5]
set yrange [0:0.7]
set ytics 0.1
set xtics 1
set output "rand-logarithmic.tex"
set title "Logarithmic Distribution"
p(x)=int(x) ? (-1/log(1-P))*(P**int(x))/int(x) : 0
plot P=0.7, p(x+0.5) title "$p=0.7$"
set xrange [:10.5]
set yrange [0:0.7]
set ytics 0.1
set xtics 1
set output "rand-hypergeometric.tex"
set title "Hypergeometric Distribution"
choose(a,b)=gamma(a+1)/(gamma(b+1)*gamma(a-b+1))
p(x)=choose(n1,int(x))*choose(n2,t-int(x))/choose(n1+n2,t)
plot n1=5, n2=20, t=3, p(x+0.5) title "$n1=5, n2=20, t=3$"
set xrange [:10.5]
set yrange [0:0.3]
set xtics 1
set ytics 0.1
set output "rand-nbinomial.tex"
set title "Negative Binomial Distribution"
p(x)= (P**n)*((1-P)**(int(x)))*gamma(n+int(x))/gamma(n)/gamma(int(x)+1.0) + 1e-5
plot P=0.5,n=3.5, p(x+0.5) title "$p=0.5,n=3.5$"
set xrange [:10.5]
set yrange [0:0.3]
set xtics 1
set ytics 0.1
set output "rand-pascal.tex"
set title "Pascal Distribution"
p(x)= (P**n)*((1-P)**(int(x)))*gamma(n+int(x))/gamma(n)/gamma(int(x)+1.0) + 1e-5
plot P=0.5,n=3, p(x+0.5) title "$p=0.5,n=3$"
######################################################################
set ticscale 1 0
set xrange [-5:5]
set yrange [-5:5]
set xtics 1
set ytics 1
set size 0.8,1.143
set size square
set output "random-walk.tex"
set title "Random walks"
set xzeroaxis
set yzeroaxis
set nokey
set noxlabel
set noylabel
plot "rand-walk.dat" using 1:2 with linesp
|