shadePhat {fastGraph}R Documentation

Displays Cumulative Probability of a Sample Proportion

Description

This function plots the probability density function of a sample proportion, shades the lines denoting probability, and computes the cumulative probability.

Usage

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

Arguments

xshade

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

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 and plotDist.

Examples

par( mfrow=c(3,2) )

shadePhat( 0.3, 20, 0.4 )

shadePhat( 0.3, 20, 0.4, lower.tail=FALSE )

shadePhat( c(0.65, 0.75), 30, 0.7, lower.tail=FALSE, xmin=0.4, xmax=1 )

shadePhat( c(0.65, 0.75), 30, 0.7, xmin=0.4, xmax=1, col=c("purple","orange") )

shadePhat( c(0.3, 0.4), 50, 0.35, xmin=0.1, xmax=0.6, col=c("blue","lightgreen") )

shadePhat( NULL, 10, 0.6, main = "Sample proportion" )

par( mfrow=c(1,1) )

[Package fastGraph version 2.1 Index]