@@ -424,17 +424,19 @@ and manipulating normal distributions of a random variable. |
|
|
424 |
424 |
:: |
425 |
425 |
|
426 |
426 |
>>> temperature_feb = NormalDist.from_samples([4, 12, -3, 2, 7, 14]) |
427 |
|
- >>> temperature_feb |
428 |
|
- NormalDist(mu=6.0, sigma=6.356099432828281) |
|
427 |
+ >>> temperature_feb.mean |
|
428 |
+ 6.0 |
|
429 |
+ >>> temperature_feb.stdev |
|
430 |
+ 6.356099432828281 |
429 |
431 |
|
430 |
432 |
>>> temperature_feb.cdf(3) # Chance of being under 3 degrees |
431 |
433 |
0.3184678262814532 |
432 |
434 |
>>> # Relative chance of being 7 degrees versus 10 degrees |
433 |
435 |
>>> temperature_feb.pdf(7) / temperature_feb.pdf(10) |
434 |
436 |
1.2039930378537762 |
435 |
437 |
|
436 |
|
- >>> el_nino = NormalDist(4, 2.5) |
437 |
|
- >>> temperature_feb += el_nino # Add in a climate effect |
|
438 |
+ >>> el_niño = NormalDist(4, 2.5) |
|
439 |
+ >>> temperature_feb += el_niño # Add in a climate effect |
438 |
440 |
>>> temperature_feb |
439 |
441 |
NormalDist(mu=10.0, sigma=6.830080526611674) |
440 |
442 |
|