Learn R Programming

lessR (version 1.5.2)

prob.normal: 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.normal(mu=0, sigma=1, lo=NULL, hi=NULL, col.nrm="black", 
         col.fill.nrm="grey85", col.fill.int="steelblue3")

Arguments

mu
Population mean of normal distribution.
sigma
Population standard deviation of normal distribution.
lo
Lowest value in the interval for which to compute probability.
hi
Highest value in the interval for which to compute probability.
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.

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: # Normal probability for values between 0 and 2
prob.normal(lo=0, hi=2)

# Mu=0, Sigma=1: # Normal probability for values lower than 2
prob.normal(hi=2)

# Mu=0, Sigma=1: # Normal probability for values larger than 2
prob.normal(lo=2)

# Mu=100, Sigma=15: change default fill of plotted interval
prob.normal(m=100, s=15, lo=115, hi=125, col.fill.int="plum")

Run the code above in your browser using DataLab