Displays Area Under Curve of Probability Density Function of Sample Proportion

Description

This function plots a probability density function of a sample proportion, shades the area under the curve, and computes the probability.

Usage

1
2
3
shadePhat(xshade = NULL, size = 1, prob = 0.5, lower.tail = TRUE, xmin = 0, xmax = 1, 
          xlab = expression(hat(p)), xtic = TRUE, digits.prob = 4, digits.xtic = 3, 
          main = NULL, col = c("black", "hotpink"), lwd = 5, ...)

Arguments

xshade

A single number or vector of two numbers, denoting values on the x-axis where shading under the curve begins and ends.

size

Number of Bernoulli trials (one or more).

prob

Probability of Bernoulli success.

lower.tail

Logical; if TRUE (default), the lowest region is shaded; otherwise, the next lowest region is shaded.

xlab

The label given to the sample proportion on the x-axis.

xmin

The minimum x-value to be graphed.

xmax

The maximum x-value to be graphed.

xtic

Logical or a vector of numbers. If xtic is TRUE (default), then the numbers on the x-axis include the median and xshade. If xtic is TRUE, then the default numbers from plot are listed on the x-axis. If xtic is a vector of numbers, then these numbers are listed on the x-axis.

digits.prob

The number of significant digits listed in the probability.

digits.xtic

The number of significant digits listed on the x-axis.

main

The main title given for the graph.

col

A vector of size two, specifying the colors of the density curve and the shading, respectively.

lwd

The line width illustrating the discrete probabilities.

...

Optional arguments to be passed to the plot function (see par).

Details

When illustrating a left-sided p-value or any other left-sided probability, xshade should be a single number and set lower.tail=TRUE (default). When illustrating a right-sided p-value or any other right-sided probability, xshade should be a single number and set lower.tail=FALSE. When illustrating a two-sided p-value or any other two-sided probability, xshade should be a vector of two numbers and set lower.tail=TRUE (default). When illustrating the complement of a two-sided p-value or the complement of any other two-sided probability, xshade should be a vector of two numbers and set lower.tail=FALSE.

This function shadePhat can be executed directly or indirectly via shadeDist.

Note

This function shadePhat calls functions plot and curve.

Author(s)

Steven T. Garren, James Madison University, Harrisonburg, Virginia, USA

See Also

shadeDist

Examples

1
2
3
4
5
shadePhat( 0.3, 20, 0.4 )
shadePhat( 0.3, 20, 0.4, lower.tail = FALSE )
shadePhat( c(0.65, 0.75), 30, 0.7, col=c("purple","orange") )
shadePhat( c(0.65, 0.75), 30, 0.7, lower.tail = FALSE )
shadePhat( c(0.3, 0.4), 50, 0.35, xmin=0.1, xmax=0.6, col=c("blue","lightgreen") )