prob_znorm: Plot a Normal Curve with Shaded Intervals by Standard...

View source: R/prob_znorm.R

prob_znormR Documentation

Plot a Normal Curve with Shaded Intervals by Standard Deviation

Description

Display a normal curve with shading according to the z-score, the number of standard deviations from the mean.

Usage

prob_znorm(mu=0, sigma=1, color_border="gray10",
         r=.10, g=.34, b=.94, a=.20,
         xlab="", ylab="", main="", 
         y_axis=FALSE, z=TRUE, axis_size=.9,
         pdf_file=NULL, width=5, height=5, ...)

Arguments

mu

Population mean of normal distribution.

sigma

Population standard deviation of normal distribution.

color_border

Color of the border of the normal curve.

r

Red component of fill color, from 0 to 1.

g

Green component of fill color, from 0 to 1.

b

Blue component of fill color, from 0 to 1.

a

Alpha component of fill color, that is, the transparency, from 0 to 1.

xlab

Label for the horizontal axis_

ylab

Label for the optional vertical axis_

main

Label for the graph title.

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.

axis_size

Magnification factor for the axis labels, the value of axis_cex.

pdf_file

Name of the pdf file to which graphics are redirected.

width

Width of the pdf file in inches.

height

Height of the pdf file in inches.

...

Other parameter values for graphics.

Details

Provide a normal curve with shading of each interval defined by the number of standard deviations from the mean. The layers are written with transparency, and over-written so that the middle interval is the darkest and the most extreme intervals, beyond three standard deviations from the mean, are the lightest. Specify a=0 to turn off the colors. Higher values of the alpha channel, as specified by a, yield darker colors. Specify a=1 for the same solid color for all intervals.

The normal densities are calculated with dnorm and plotted with plot.

Author(s)

David W. Gerbing (Portland State University; gerbing@pdx.edu)

See Also

dnorm, plot.

Examples

# Mu=0, Sigma=1: Standard normal 
prob_znorm()

# distribution for height of American women, mu=65.5, sigma=2.5
prob_znorm(65.5, 2.5, xlab="Height of American Women")

# do a red fill color
prob_znorm(65.5, 2.5, r=.9, xlab="Height of American Women")

lessR documentation built on Nov. 12, 2023, 1:08 a.m.