-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathStatistics.html
More file actions
2646 lines (2191 loc) · 114 KB
/
Statistics.html
File metadata and controls
2646 lines (2191 loc) · 114 KB
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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!--
Automatically generated HTML file from DocOnce source
(https://github.com/hplgit/doconce/)
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="description" content="Data Analysis and Machine Learning: Elements of Probability Theory and Statistical Data Analysis">
<title>Data Analysis and Machine Learning: Elements of Probability Theory and Statistical Data Analysis</title>
<style type="text/css">
/* bloodish style */
body {
font-family: Helvetica, Verdana, Arial, Sans-serif;
color: #404040;
background: #ffffff;
}
h1 { font-size: 1.8em; color: #8A0808; }
h2 { font-size: 1.6em; color: #8A0808; }
h3 { font-size: 1.4em; color: #8A0808; }
h4 { color: #8A0808; }
a { color: #8A0808; text-decoration:none; }
tt { font-family: "Courier New", Courier; }
/* pre style removed because it will interfer with pygments */
p { text-indent: 0px; }
hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
p.caption { width: 80%; font-style: normal; text-align: left; }
hr.figure { border: 0; width: 80%; border-bottom: 1px solid #aaa}
.alert-text-small { font-size: 80%; }
.alert-text-large { font-size: 130%; }
.alert-text-normal { font-size: 90%; }
.alert {
padding:8px 35px 8px 14px; margin-bottom:18px;
text-shadow:0 1px 0 rgba(255,255,255,0.5);
border:1px solid #bababa;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
color: #555;
background-color: #f8f8f8;
background-position: 10px 5px;
background-repeat: no-repeat;
background-size: 38px;
padding-left: 55px;
width: 75%;
}
.alert-block {padding-top:14px; padding-bottom:14px}
.alert-block > p, .alert-block > ul {margin-bottom:1em}
.alert li {margin-top: 1em}
.alert-block p+p {margin-top:5px}
.alert-notice { background-image: url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_gray_notice.png); }
.alert-summary { background-image:url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_gray_summary.png); }
.alert-warning { background-image: url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_gray_warning.png); }
.alert-question {background-image:url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_gray_question.png); }
div { text-align: justify; text-justify: inter-word; }
</style>
<script src="https://sagecell.sagemath.org/static/jquery.min.js"></script>
<script src="https://sagecell.sagemath.org/embedded_sagecell.js"></script>
<link rel="stylesheet" type="text/css" href="https://sagecell.sagemath.org/static/sagecell_embed.css">
<script>
$(function () {
// Make the div with id 'mycell' a Sage cell
sagecell.makeSagecell({inputLocation: '#mycell',
template: sagecell.templates.minimal,
evalButtonText: 'Activate'});
// Make *any* div with class 'compute' a Sage cell
sagecell.makeSagecell({inputLocation: 'div.compute',
evalButtonText: 'Evaluate'});
});
</script>
</head>
<!-- tocinfo
{'highest level': 1,
'sections': [('Things to add', 2, None, '___sec0'),
('Domains and probabilities', 2, None, '___sec1'),
('Tossing a dice', 2, None, '___sec2'),
('Stochastic variables', 2, None, '___sec3'),
('Stochastic variables and the main concepts, the discrete case',
2,
None,
'___sec4'),
('Stochastic variables and the main concepts, the continuous '
'case',
2,
None,
'___sec5'),
('The cumulative probability', 2, None, '___sec6'),
('Properties of PDFs', 2, None, '___sec7'),
('Important distributions, the uniform distribution',
2,
None,
'___sec8'),
('Gaussian distribution', 2, None, '___sec9'),
('Exponential distribution', 2, None, '___sec10'),
('Expectation values', 2, None, '___sec11'),
('Stochastic variables and the main concepts, mean values',
2,
None,
'___sec12'),
('Stochastic variables and the main concepts, central moments, '
'the variance',
2,
None,
'___sec13'),
('Probability Distribution Functions', 2, None, '___sec14'),
('Probability Distribution Functions', 2, None, '___sec15'),
('The three famous Probability Distribution Functions',
2,
None,
'___sec16'),
('Probability Distribution Functions, the normal distribution',
2,
None,
'___sec17'),
('Probability Distribution Functions, the normal distribution',
2,
None,
'___sec18'),
('Probability Distribution Functions, the cumulative '
'distribution',
2,
None,
'___sec19'),
('Probability Distribution Functions, other important '
'distribution',
2,
None,
'___sec20'),
('Probability Distribution Functions, the binomial distribution',
2,
None,
'___sec21'),
("Probability Distribution Functions, Poisson's distribution",
2,
None,
'___sec22'),
("Probability Distribution Functions, Poisson's distribution",
2,
None,
'___sec23'),
('Additions to make', 2, None, '___sec24'),
('Meet the covariance!', 2, None, '___sec25'),
('Meet the covariance in matrix disguise', 2, None, '___sec26'),
('Covariance', 2, None, '___sec27'),
('Meet the covariance, uncorrelated events',
2,
None,
'___sec28'),
('Numerical experiments and the covariance', 2, None, '___sec29'),
('Numerical experiments and the covariance', 2, None, '___sec30'),
('Numerical experiments and the covariance, actual situations',
2,
None,
'___sec31'),
('Numerical experiments and the covariance, our observables',
2,
None,
'___sec32'),
('Numerical experiments and the covariance, the sample variance',
2,
None,
'___sec33'),
('Numerical experiments and the covariance, central limit '
'theorem',
2,
None,
'___sec34'),
('Definition of Correlation Functions and Standard Deviation',
2,
None,
'___sec35'),
('Definition of Correlation Functions and Standard Deviation',
2,
None,
'___sec36'),
('Definition of Correlation Functions and Standard Deviation',
2,
None,
'___sec37'),
('Definition of Correlation Functions and Standard Deviation',
2,
None,
'___sec38'),
('Definition of Correlation Functions and Standard Deviation, '
'sample variance',
2,
None,
'___sec39'),
('Definition of Correlation Functions and Standard Deviation',
2,
None,
'___sec40'),
('Code to compute the Covariance matrix and the Covariance',
2,
None,
'___sec41'),
('Random Numbers', 1, None, '___sec42'),
('Random Numbers, better name: pseudo random numbers',
1,
None,
'___sec43'),
('Random number generator RNG', 1, None, '___sec44'),
('Random number generator RNG and periodic outputs',
1,
None,
'___sec45'),
('Random number generator RNG and its period',
1,
None,
'___sec46'),
('Random number generator RNG, other examples',
1,
None,
'___sec47'),
('Random number generator RNG, other examples',
1,
None,
'___sec48'),
('Random number generator RNG, RAN0', 1, None, '___sec49'),
('Random number generator RNG, RAN0', 1, None, '___sec50'),
('Random number generator RNG, RAN0', 1, None, '___sec51'),
('Random number generator RNG, RAN0', 1, None, '___sec52'),
('Random number generator RNG, RAN0 code', 1, None, '___sec53'),
('Properties of Selected Random Number Generators',
2,
None,
'___sec54'),
('Properties of Selected Random Number Generators',
2,
None,
'___sec55'),
('Properties of Selected Random Number Generators',
2,
None,
'___sec56'),
('Simple demonstration of RNGs using python',
2,
None,
'___sec57'),
('Properties of Selected Random Number Generators',
2,
None,
'___sec58'),
('Autocorrelation function', 2, None, '___sec59'),
('Correlation function and which random number generators should '
'I use',
2,
None,
'___sec60'),
('Which RNG should I use?', 1, None, '___sec61'),
('How to use the Mersenne generator', 2, None, '___sec62'),
('Why blocking?', 2, None, '___sec63'),
('Why blocking?', 2, None, '___sec64'),
('Code to demonstrate the calculation of the autocorrelation '
'function',
2,
None,
'___sec65'),
('What is blocking?', 2, None, '___sec66'),
('What is blocking?', 2, None, '___sec67'),
('What is blocking?', 2, None, '___sec68'),
('Implementation', 2, None, '___sec69'),
('Actual implementation with code, main function',
2,
None,
'___sec70'),
('The Bootstrap method', 2, None, '___sec71'),
('Bootstrapping', 2, None, '___sec72'),
('Bootstrapping, recipe', 2, None, '___sec73'),
('Bootstrapping, '
'"code":"https://github.com/CompPhysics/MachineLearning/blob/master/doc/Programs/Sampling/analysis.py"',
2,
None,
'___sec74'),
('Jackknife, '
'"code":"https://github.com/CompPhysics/MachineLearning/blob/master/doc/Programs/Sampling/analysis.py"',
2,
None,
'___sec75')]}
end of tocinfo -->
<body>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
equationNumbers: { autoNumber: "AMS" },
extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
}
});
</script>
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- ------------------- main content ---------------------- -->
<center><h1>Data Analysis and Machine Learning: Elements of Probability Theory and Statistical Data Analysis</h1></center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
<center>
<b>Morten Hjorth-Jensen</b> [1, 2]
</center>
<p>
<!-- institution(s) -->
<center>[1] <b>Department of Physics, University of Oslo</b></center>
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Aug 24, 2018</h4></center> <!-- date -->
<br>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec0">Things to add </h2>
Add general statistic elements (probability theory mainly), assumed knowledge
Repeat basic definitions.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec1">Domains and probabilities </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
Consider the following simple example, namely the tossing of a dice, resulting in the following possible values
$$
\begin{equation*}
\{2,3,4,5,6,7,8,9,10,11,12\}.
\end{equation*}
$$
These values are called the <em>domain</em>.
To this domain we have the corresponding <em>probabilities</em>
$$
\begin{equation*}
\{1/36,2/36/3/36,4/36,5/36,6/36,5/36,4/36,3/36,2/36,1/36\}.
\end{equation*}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec2">Tossing a dice </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
The numbers in the domain are the outcomes of the physical process tossing the dice.
We cannot tell beforehand whether the outcome is 3 or 5 or any other number in this domain.
This defines the randomness of the outcome, or unexpectedness or any other synonimous word which
encompasses the uncertitude of the final outcome.
<p>
The only thing we can tell beforehand
is that say the outcome 2 has a certain probability.
If our favorite hobby is to spend an hour every evening throwing dice and
registering the sequence of outcomes, we will note that the numbers in the above domain
$$
\begin{equation*}
\{2,3,4,5,6,7,8,9,10,11,12\},
\end{equation*}
$$
appear in a random order. After 11 throws the results may look like
$$
\begin{equation*}
\{10,8,6,3,6,9,11,8,12,4,5\}.
\end{equation*}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec3">Stochastic variables </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
<p>
<b>Random variables are characterized by a domain which contains all possible values that the random value may take. This domain has a corresponding PDF</b>.
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec4">Stochastic variables and the main concepts, the discrete case </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
There are two main concepts associated with a stochastic variable. The
<em>domain</em> is the set \( \mathbb D = \{x\} \) of all accessible values
the variable can assume, so that \( X \in \mathbb D \). An example of a
discrete domain is the set of six different numbers that we may get by
throwing of a dice, \( x\in\{1,\,2,\,3,\,4,\,5,\,6\} \).
<p>
The <em>probability distribution function (PDF)</em> is a function
\( p(x) \) on the domain which, in the discrete case, gives us the
probability or relative frequency with which these values of \( X \)
occur
$$
\begin{equation*}
p(x) = \mathrm{Prob}(X=x).
\end{equation*}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec5">Stochastic variables and the main concepts, the continuous case </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
In the continuous case, the PDF does not directly depict the
actual probability. Instead we define the probability for the
stochastic variable to assume any value on an infinitesimal interval
around \( x \) to be \( p(x)dx \). The continuous function \( p(x) \) then gives us
the <em>density</em> of the probability rather than the probability
itself. The probability for a stochastic variable to assume any value
on a non-infinitesimal interval \( [a,\,b] \) is then just the integral
$$
\begin{equation*}
\mathrm{Prob}(a\leq X\leq b) = \int_a^b p(x)dx.
\end{equation*}
$$
Qualitatively speaking, a stochastic variable represents the values of
numbers chosen as if by chance from some specified PDF so that the
selection of a large set of these numbers reproduces this PDF.
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec6">The cumulative probability </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
Of interest to us is the <em>cumulative probability
distribution function</em> (<b>CDF</b>), \( P(x) \), which is just the probability
for a stochastic variable \( X \) to assume any value less than \( x \)
$$
\begin{equation*}
P(x)=\mathrm{Prob(}X\leq x\mathrm{)} =
\int_{-\infty}^x p(x^{\prime})dx^{\prime}.
\end{equation*}
$$
The relation between a CDF and its corresponding PDF is then
$$
\begin{equation*}
p(x) = \frac{d}{dx}P(x).
\end{equation*}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec7">Properties of PDFs </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
<p>
There are two properties that all PDFs must satisfy. The first one is
positivity (assuming that the PDF is normalized)
$$
\begin{equation*}
0 \leq p(x) \leq 1.
\end{equation*}
$$
Naturally, it would be nonsensical for any of the values of the domain
to occur with a probability greater than \( 1 \) or less than \( 0 \). Also,
the PDF must be normalized. That is, all the probabilities must add up
to unity. The probability of "anything" to happen is always unity. For
both discrete and continuous PDFs, this condition is
$$
\begin{align*}
\sum_{x_i\in\mathbb D} p(x_i) & = 1,\\
\int_{x\in\mathbb D} p(x)\,dx & = 1.
\end{align*}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec8">Important distributions, the uniform distribution </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
The first one
is the most basic PDF; namely the uniform distribution
$$
\begin{equation}
p(x) = \frac{1}{b-a}\theta(x-a)\theta(b-x),
\label{eq:unifromPDF}
\end{equation}
$$
with
$$
\begin{equation*}
\begin{array}{ll}
\theta(x)=0 & x < 0 \\
\theta(x)=\frac{1}{b-a} & \in [a,b].
\end{array}
\end{equation*}
$$
The normal distribution with \( b=1 \) and \( a=0 \) is used to generate random numbers.
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec9">Gaussian distribution </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
The second one is the Gaussian Distribution
$$
\begin{equation*}
p(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp{(-\frac{(x-\mu)^2}{2\sigma^2})},
\end{equation*}
$$
with mean value \( \mu \) and standard deviation \( \sigma \). If \( \mu=0 \) and \( \sigma=1 \), it is normally called the <b>standard normal distribution</b>
$$
\begin{equation*}
p(x) = \frac{1}{\sqrt{2\pi}} \exp{(-\frac{x^2}{2})},
\end{equation*}
$$
<p>
The following simple Python code plots the above distribution for different values of \( \mu \) and \( \sigma \).
<p>
<div class="compute"><script type="text/x-sage">
import numpy as np
from math import acos, exp, sqrt
from matplotlib import pyplot as plt
from matplotlib import rc, rcParams
import matplotlib.units as units
import matplotlib.ticker as ticker
rc('text',usetex=True)
rc('font',**{'family':'serif','serif':['Gaussian distribution']})
font = {'family' : 'serif',
'color' : 'darkred',
'weight' : 'normal',
'size' : 16,
}
pi = acos(-1.0)
mu0 = 0.0
sigma0 = 1.0
mu1= 1.0
sigma1 = 2.0
mu2 = 2.0
sigma2 = 4.0
x = np.linspace(-20.0, 20.0)
v0 = np.exp(-(x*x-2*x*mu0+mu0*mu0)/(2*sigma0*sigma0))/sqrt(2*pi*sigma0*sigma0)
v1 = np.exp(-(x*x-2*x*mu1+mu1*mu1)/(2*sigma1*sigma1))/sqrt(2*pi*sigma1*sigma1)
v2 = np.exp(-(x*x-2*x*mu2+mu2*mu2)/(2*sigma2*sigma2))/sqrt(2*pi*sigma2*sigma2)
plt.plot(x, v0, 'b-', x, v1, 'r-', x, v2, 'g-')
plt.title(r'{\bf Gaussian distributions}', fontsize=20)
plt.text(-19, 0.3, r'Parameters: $\mu = 0$, $\sigma = 1$', fontdict=font)
plt.text(-19, 0.18, r'Parameters: $\mu = 1$, $\sigma = 2$', fontdict=font)
plt.text(-19, 0.08, r'Parameters: $\mu = 2$, $\sigma = 4$', fontdict=font)
plt.xlabel(r'$x$',fontsize=20)
plt.ylabel(r'$p(x)$ [MeV]',fontsize=20)
# Tweak spacing to prevent clipping of ylabel
plt.subplots_adjust(left=0.15)
plt.savefig('gaussian.pdf', format='pdf')
plt.show()
</script></div>
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec10">Exponential distribution </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
Another important distribution in science is the exponential distribution
$$
\begin{equation*}
p(x) = \alpha\exp{-(\alpha x)}.
\end{equation*}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec11">Expectation values </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
Let \( h(x) \) be an arbitrary continuous function on the domain of the stochastic
variable \( X \) whose PDF is \( p(x) \). We define the <em>expectation value</em>
of \( h \) with respect to \( p \) as follows
$$
\begin{equation}
\langle h \rangle_X \equiv \int\! h(x)p(x)\,dx
\label{eq:expectation_value_of_h_wrt_p}
\end{equation}
$$
Whenever the PDF is known implicitly, like in this case, we will drop
the index \( X \) for clarity.
A particularly useful class of special expectation values are the
<em>moments</em>. The \( n \)-th moment of the PDF \( p \) is defined as
follows
$$
\begin{equation*}
\langle x^n \rangle \equiv \int\! x^n p(x)\,dx
\end{equation*}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec12">Stochastic variables and the main concepts, mean values </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
The zero-th moment \( \langle 1\rangle \) is just the normalization condition of
\( p \). The first moment, \( \langle x\rangle \), is called the <em>mean</em> of \( p \)
and often denoted by the letter \( \mu \)
$$
\begin{equation*}
\langle x\rangle = \mu \equiv \int x p(x)dx,
\end{equation*}
$$
for a continuous distribution and
$$
\begin{equation*}
\langle x\rangle = \mu \equiv \frac{1}{N}\sum_{i=1}^N x_i p(x_i),
\end{equation*}
$$
for a discrete distribution.
Qualitatively it represents the centroid or the average value of the
PDF and is therefore simply called the expectation value of \( p(x) \).
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec13">Stochastic variables and the main concepts, central moments, the variance </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
<p>
A special version of the moments is the set of <em>central moments</em>, the n-th central moment defined as
$$
\begin{equation*}
\langle (x-\langle x\rangle )^n\rangle \equiv \int\! (x-\langle x\rangle)^n p(x)\,dx
\end{equation*}
$$
The zero-th and first central moments are both trivial, equal \( 1 \) and
\( 0 \), respectively. But the second central moment, known as the
<em>variance</em> of \( p \), is of particular interest. For the stochastic
variable \( X \), the variance is denoted as \( \sigma^2_X \) or \( \mathrm{Var}(X) \)
$$
\begin{align*}
\sigma^2_X &=\mathrm{Var}(X) = \langle (x-\langle x\rangle)^2\rangle =
\int (x-\langle x\rangle)^2 p(x)dx\\
& = \int\left(x^2 - 2 x \langle x\rangle^{2} +\langle x\rangle^2\right)p(x)dx\\
& = \langle x^2\rangle\rangle - 2 \langle x\rangle\langle x\rangle + \langle x\rangle^2\\
& = \langle x^2 \rangle - \langle x\rangle^2
\end{align*}
$$
The square root of the variance, \( \sigma =\sqrt{\langle (x-\langle x\rangle)^2\rangle} \) is called the
<b>standard deviation</b> of \( p \). It is the RMS (root-mean-square)
value of the deviation of the PDF from its mean value, interpreted
qualitatively as the "spread" of \( p \) around its mean.
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec14">Probability Distribution Functions </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
<p>
The following table collects properties of probability distribution functions.
In our notation we reserve the label \( p(x) \) for the probability of a certain event,
while \( P(x) \) is the cumulative probability.
<p>
<table border="1">
<thead>
<tr><th align="center"> </th> <th align="center"> Discrete PDF </th> <th align="center"> Continuous PDF </th> </tr>
</thead>
<tbody>
<tr><td align="left"> Domain </td> <td align="center"> \( \left\{x_1, x_2, x_3, \dots, x_N\right\} \) </td> <td align="center"> \( [a,b] \) </td> </tr>
<tr><td align="left"> Probability </td> <td align="center"> \( p(x_i) \) </td> <td align="center"> \( p(x)dx \) </td> </tr>
<tr><td align="left"> Cumulative </td> <td align="center"> \( P_i=\sum_{l=1}^ip(x_l) \) </td> <td align="center"> \( P(x)=\int_a^xp(t)dt \) </td> </tr>
<tr><td align="left"> Positivity </td> <td align="center"> \( 0 \le p(x_i) \le 1 \) </td> <td align="center"> \( p(x) \ge 0 \) </td> </tr>
<tr><td align="left"> Positivity </td> <td align="center"> \( 0 \le P_i \le 1 \) </td> <td align="center"> \( 0 \le P(x) \le 1 \) </td> </tr>
<tr><td align="left"> Monotonic </td> <td align="center"> \( P_i \ge P_j \) if \( x_i \ge x_j \) </td> <td align="center"> \( P(x_i) \ge P(x_j) \) if \( x_i \ge x_j \) </td> </tr>
<tr><td align="left"> Normalization </td> <td align="center"> \( P_N=1 \) </td> <td align="center"> \( P(b)=1 \) </td> </tr>
</tbody>
</table>
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec15">Probability Distribution Functions </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
With a PDF we can compute expectation values of selected quantities such as
$$
\begin{equation*}
\langle x^k\rangle=\frac{1}{N}\sum_{i=1}^{N}x_i^kp(x_i),
\end{equation*}
$$
if we have a discrete PDF or
$$
\begin{equation*}
\langle x^k\rangle=\int_a^b x^kp(x)dx,
\end{equation*}
$$
in the case of a continuous PDF. We have already defined the mean value \( \mu \)
and the variance \( \sigma^2 \).
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec16">The three famous Probability Distribution Functions </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
<p>
There are at least three PDFs which one may encounter. These are the
<p>
<b>Uniform distribution</b>
$$
\begin{equation*}
p(x)=\frac{1}{b-a}\Theta(x-a)\Theta(b-x),
\end{equation*}
$$
yielding probabilities different from zero in the interval \( [a,b] \).
<p>
<b>The exponential distribution</b>
$$
\begin{equation*}
p(x)=\alpha \exp{(-\alpha x)},
\end{equation*}
$$
yielding probabilities different from zero in the interval \( [0,\infty) \) and with mean value
$$
\begin{equation*}
\mu = \int_0^{\infty}xp(x)dx=\int_0^{\infty}x\alpha \exp{(-\alpha x)}dx=\frac{1}{\alpha},
\end{equation*}
$$
</div>
with variance
$$
\begin{equation*}
\sigma^2=\int_0^{\infty}x^2p(x)dx-\mu^2 = \frac{1}{\alpha^2}.
\end{equation*}
$$
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec17">Probability Distribution Functions, the normal distribution </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
Finally, we have the so-called univariate normal distribution, or just the <b>normal distribution</b>
$$
\begin{equation*}
p(x)=\frac{1}{b\sqrt{2\pi}}\exp{\left(-\frac{(x-a)^2}{2b^2}\right)}
\end{equation*}
$$
with probabilities different from zero in the interval \( (-\infty,\infty) \).
The integral \( \int_{-\infty}^{\infty}\exp{\left(-(x^2\right)}dx \) appears in many calculations, its value
is \( \sqrt{\pi} \), a result we will need when we compute the mean value and the variance.
The mean value is
$$
\begin{equation*}
\mu = \int_0^{\infty}xp(x)dx=\frac{1}{b\sqrt{2\pi}}\int_{-\infty}^{\infty}x \exp{\left(-\frac{(x-a)^2}{2b^2}\right)}dx,
\end{equation*}
$$
which becomes with a suitable change of variables
$$
\begin{equation*}
\mu =\frac{1}{b\sqrt{2\pi}}\int_{-\infty}^{\infty}b\sqrt{2}(a+b\sqrt{2}y)\exp{-y^2}dy=a.
\end{equation*}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec18">Probability Distribution Functions, the normal distribution </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
Similarly, the variance becomes
$$
\begin{equation*}
\sigma^2 = \frac{1}{b\sqrt{2\pi}}\int_{-\infty}^{\infty}(x-\mu)^2 \exp{\left(-\frac{(x-a)^2}{2b^2}\right)}dx,
\end{equation*}
$$
and inserting the mean value and performing a variable change we obtain
$$
\begin{equation*}
\sigma^2 = \frac{1}{b\sqrt{2\pi}}\int_{-\infty}^{\infty}b\sqrt{2}(b\sqrt{2}y)^2\exp{\left(-y^2\right)}dy=
\frac{2b^2}{\sqrt{\pi}}\int_{-\infty}^{\infty}y^2\exp{\left(-y^2\right)}dy,
\end{equation*}
$$
and performing a final integration by parts we obtain the well-known result \( \sigma^2=b^2 \).
It is useful to introduce the standard normal distribution as well, defined by \( \mu=a=0 \), viz. a distribution
centered around zero and with a variance \( \sigma^2=1 \), leading to
$$
\begin{equation}
p(x)=\frac{1}{\sqrt{2\pi}}\exp{\left(-\frac{x^2}{2}\right)}.
\label{_auto1}
\end{equation}
$$
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec19">Probability Distribution Functions, the cumulative distribution </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
<p>
The exponential and uniform distributions have simple cumulative functions,
whereas the normal distribution does not, being proportional to the so-called
error function \( erf(x) \), given by
$$
\begin{equation*}
P(x) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^x\exp{\left(-\frac{t^2}{2}\right)}dt,
\end{equation*}
$$
which is difficult to evaluate in a quick way.
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec20">Probability Distribution Functions, other important distribution </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
<p>
Some other PDFs which one encounters often in the natural sciences are the binomial distribution
$$
\begin{equation*}
p(x) = \left(\begin{array}{c} n \\ x\end{array}\right)y^x(1-y)^{n-x} \hspace{0.5cm}x=0,1,\dots,n,
\end{equation*}
$$
where \( y \) is the probability for a specific event, such as the tossing of a coin or moving left or right
in case of a random walker. Note that \( x \) is a discrete stochastic variable.
<p>
The sequence of binomial trials is characterized by the following definitions
<ul>
<li> Every experiment is thought to consist of \( N \) independent trials.</li>
<li> In every independent trial one registers if a specific situation happens or not, such as the jump to the left or right of a random walker.</li>
<li> The probability for every outcome in a single trial has the same value, for example the outcome of tossing (either heads or tails) a coin is always \( 1/2 \).</li>
</ul>
</div>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec21">Probability Distribution Functions, the binomial distribution </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
<p>
In order to compute the mean and variance we need to recall Newton's binomial
formula
$$
\begin{equation*}
(a+b)^m=\sum_{n=0}^m \left(\begin{array}{c} m \\ n\end{array}\right)a^nb^{m-n},
\end{equation*}
$$
which can be used to show that
$$
\begin{equation*}
\sum_{x=0}^n\left(\begin{array}{c} n \\ x\end{array}\right)y^x(1-y)^{n-x} = (y+1-y)^n = 1,
\end{equation*}
$$
the PDF is normalized to one.
The mean value is
$$
\begin{equation*}
\mu = \sum_{x=0}^n x\left(\begin{array}{c} n \\ x\end{array}\right)y^x(1-y)^{n-x} =
\sum_{x=0}^n x\frac{n!}{x!(n-x)!}y^x(1-y)^{n-x},
\end{equation*}
$$
resulting in
$$
\begin{equation*}
\mu =
\sum_{x=0}^n x\frac{(n-1)!}{(x-1)!(n-1-(x-1))!}y^{x-1}(1-y)^{n-1-(x-1)},
\end{equation*}
$$