Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maximilian Vitz
Lecture Statistics and Data Analysis
Commits
dfd9db9d
Commit
dfd9db9d
authored
Oct 27, 2021
by
Maximilian Vitz
Browse files
Updated Lecture 2 and Lecture 3
parent
0473dcd0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Week2/Lecture2.ipynb
0 → 100644
View file @
dfd9db9d
%% Cell type:markdown id:4e98befd-a710-4193-9393-d52d8a7fbcc3 tags:
## Poisson distribution
$$ P(k;
\l
ambda) =
\f
rac{
\l
ambda^k}{k!}
\m
box{e}^{-
\l
ambda}$$
%% Cell type:code id:9c2b256c-333a-4b6c-8241-523b8aeb919f tags:
```
python
from
scipy.stats
import
poisson
,
binom
```
%% Cell type:code id:ccf39158-28be-4ba4-a898-a5b14be924e1 tags:
```
python
poisson
.
pmf
(
2
,
3.5
)
```
%%%% Output: execute_result
0.18495897346170082
%% Cell type:code id:6643ab02-3c24-40b8-90e2-c0ffab308f16 tags:
```
python
poisson
.
pmf
(
0
,
3.5
)
+
poisson
.
pmf
(
1
,
3.5
)
+
poisson
.
pmf
(
2
,
3.5
)
```
%%%% Output: execute_result
0.3208471988621341
%% Cell type:code id:19fc9d45-64f9-4e0f-adab-b044c59a083e tags:
```
python
poisson
.
cdf
(
2
,
3.5
)
```
%%%% Output: execute_result
0.32084719886213414
%% Cell type:markdown id:9d2578c1-302c-4ea4-8308-8c80d5ab9288 tags:
## Binomial distribution
$$ B(k;N,p) =
\l
eft(
\b
egin{array}{c} N
\\
k
\\
\e
nd{array}
\r
ight) p^k (1-p)^{N-k} $$
%% Cell type:code id:a9d78b0f-49ca-44c8-964b-ab1d593ce540 tags:
```
python
binom
.
pmf
(
2
,
10
,
0.3
)
```
%%%% Output: execute_result
0.2334744405
%% Cell type:code id:4c029640-fec5-4aeb-9644-7e965b0dcbee tags:
```
python
binom
.
pmf
(
0
,
10
,
0.3
)
+
binom
.
pmf
(
1
,
10
,
0.3
)
+
binom
.
pmf
(
2
,
10
,
0.3
)
```
%%%% Output: execute_result
0.3827827864000002
%% Cell type:code id:fa781bea-3265-4915-b299-0870a76b8053 tags:
```
python
binom
.
cdf
(
2
,
10
,
0.3
)
```
%%%% Output: execute_result
0.3827827864
%% Cell type:code id:a88c9312-41d1-44ba-b600-ca8fcbbb5c75 tags:
```
python
```
Week3/Lecture3.ipynb
0 → 100644
View file @
dfd9db9d
%% Cell type:code id: tags:
```
python
import
numpy
as
np
```
%% Cell type:code id: tags:
```
python
import
matplotlib.pyplot
as
plt
```
%% Cell type:code id: tags:
```
python
T0
=
1
sigT
=
0.2
```
%% Cell type:markdown id: tags:
### error propagation
%% Cell type:code id: tags:
```
python
f0
=
1
/
T0
sigf
=
1
/
T0
**
2
*
sigT
print
(
"error propagation: freq "
,
f0
,
" +/- "
,
sigf
)
```
%%%% Output: stream
error propagation: freq 1.0 +/- 0.2
%% Cell type:markdown id: tags:
### simulation
%% Cell type:code id: tags:
```
python
T
=
np
.
random
.
normal
(
T0
,
sigT
,
1000
)
```
%% Cell type:code id: tags:
```
python
plt
.
hist
(
T
)
```
%%%% Output: execute_result
(array([ 13., 52., 116., 158., 215., 197., 139., 80., 19., 11.]),
array([0.48111168, 0.59232677, 0.70354186, 0.81475695, 0.92597204,
1.03718713, 1.14840222, 1.25961732, 1.37083241, 1.4820475 ,
1.59326259]),
<BarContainer object of 10 artists>)
%%%% Output: display_data

%% Cell type:code id: tags:
```
python
f
=
1
/
T
plt
.
hist
(
f
)
```
%%%% Output: execute_result
(array([ 78., 259., 293., 174., 103., 59., 15., 12., 5., 2.]),
array([0.62764293, 0.77273059, 0.91781824, 1.0629059 , 1.20799356,
1.35308122, 1.49816887, 1.64325653, 1.78834419, 1.93343184,
2.0785195 ]),
<BarContainer object of 10 artists>)
%%%% Output: display_data

%% Cell type:code id: tags:
```
python
print
(
"simulation: freq "
,
np
.
mean
(
f
),
" +/- "
,
np
.
std
(
f
))
```
%%%% Output: stream
simulation: freq 1.0321737435939056 +/- 0.2231584633106588
%% Cell type:code id: tags:
```
python
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment