Return the boundaries containing 100% p
points drawn from a normal
distribution.
bounds = normalbounds(p)
bounds = normalbounds(p, mu)
bounds = normalbounds(p, mu, sigma)
p | Fraction of data within bounds (e.g., 0.95 for 95%) |
---|---|
mu | Mean (defaults to 0) |
sigma | Standard deviation (defaults to 1) |
bounds | Bounds containing p fraction of data |
---|
We'll make sure that the theoretical and empircal bounds match up reasonably well for some random draws.
% Generate 10,000 samples from a normal distribution.
n = 10000;
mu = 1;
sigma = 3;
x = sigma * randn(1, n) + mu;
% Get the theoretical 95% bounds.
b = normalbounds(0.95, mu, sigma);
% See what percentage of the data are within bounds.
sum(b(1) < x & x < b(2)) / n
ans =
0.9477
*kf
v1.0.3