Learn R Programming

lessR (version 2.3.1)

prob.norm: Compute and Plot Normal Curve Probabilities over an Interval

Description

Calculate the probability of an interval for a normal distribution with specified mean and standard deviation, providing both the numerical probability and a plot of the interval with the corresponding normal curve.

Usage

prob.norm(lo=NULL, hi=NULL, mu=0, sigma=1, col.nrm="black", 
         col.fill.nrm="grey91", col.fill.int="slategray3", 
         ylab="", y.axis=FALSE, z=TRUE, mag=.9, ...)

Arguments

lo
Lowest value in the interval for which to compute probability.
hi
Highest value in the interval for which to compute probability.
mu
Population mean of normal distribution.
sigma
Population standard deviation of normal distribution.
col.nrm
Color of the border of the normal curve.
col.fill.nrm
Fill color of the normal curve.
col.fill.int
Fill color of the interval for which the probability is computed.
ylab
Label for the optional vertical axis.
y.axis
If TRUE, then a vertical axis is included.
z
If TRUE, then include z-values on the horizontal-axis. Set to FALSE if mu=0 and sigma=1.
mag
Magnification factor for the axis labels, the value of cex.axis.
...
Other parameter values for graphics.

Details

Calculate the normal curve probability for the specified interval and normal curve. If there is no upper value of the interval provided, hi, then the upper tail probability is provided, that is, from the specified value until positive infinity. If there is no lower value, lo, then the lower tail probability is provided. The probability is calculated with pnorm.

See Also

pnorm, plot.

Examples

Run this code
# Mu=0, Sigma=1: Standard normal prob, values between 0 and 2
prob.norm(0,2)

# Mu=0, Sigma=1: Standard normal prob, values lower than 2
prob.norm(hi=2)

# Mu=0, Sigma=1: Standard normal prob, values larger than 2
prob.norm(lo=2)

# Mu=100, Sigma=15: Change default fill color of plotted interval
prob.norm(lo=115, hi=125, mu=100, sigma=15, col.fill.int="plum")

Run the code above in your browser using DataLab