Choose random inputsLesson 11 of 76 · 7 min
Model symmetric variation
Check the support and spread of a normal input model.
A normal distribution is a symmetric bell-shaped model, specified by mean μ and standard deviation σ. The notation N(μ,σ²) lists its mean and variance; NumPy's scale argument takes σ, not σ². Its possible values include every real number, including negatives.
The curve is a density: probability comes from area over an interval, not the height at one point. The whole area is one; a single exact value has zero probability in this continuous model. For zero-centred sensor errors, negative and positive values make sense. For a duration, negative values may make the model unsuitable.
The example adds sensor errors with SD 2 to a fixed reference. Clipping negative durations to zero would change their model by piling probability at exactly zero, a point mass. Check what the quantity can mean before selecting a familiar curve. Outcome SD describes individual errors; later MCSE describes numerical uncertainty in a summary.
In this picture E is the sensor error, not the expectation operator. N(0,2²) has mean 0, variance 4 and SD 2.
Will a normal distribution with a positive mean always generate positive values?
Write a prediction (optional)
Seeded teaching simulation
Select Run Python below with the code unchanged.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
Published example output
This result comes from the original Python. Your runs appear above. Build environment ↗
Mean reading: 50.011 Reading SD: 1.994 Fraction within two error SDs: 0.9532 Negative duration fraction in a questionable model: 0.3086
Read the first result
Compare Mean reading and Reading SD with the fixed reference and error SD in the code. Negative duration fraction in a questionable model comes from a separate example that uses a normal model for durations.
Try an edit
Replace error_sd = 2 with error_sd = 4. Select Run Python again. Compare Reading SD and Fraction within two error SDs. Wider error draws spread the readings. Why does the fraction inside twice the new SD stay about the same?
Scope. The sensor model assumes additive independent normal errors with no calibration bias.
Try a fresh case
You replace every negative normal duration with zero. What have you done?
Need a hint?
Hint 1
Ask where the clipped probability goes.
Hint 2
Distinguish editing a distribution from observing better data.