Learn R Programming

fastGraph (version 2.1)

fastGraph-package: Fast Drawing and Shading of Graphs of Statistical Distributions

Description

Provides functionality to produce graphs of probability density functions and cumulative distribution functions with few keystrokes, allows shading under the curve of the probability density function to illustrate concepts such as p-values and critical values, and fits a simple linear regression line on a scatter plot with the equation as the main title.

Arguments

Details

  • getMinMax is called by both plotDist and shadeDist for determining a reasonable domain for plotting the graph.

  • plotDist draws as many as three probability density functions or cumulative distribution functions on the same graph.

  • plotLine performs a simple scatter plot, fits the linear regression line, and states the equation of the line in the title.

  • shadeDist draws a probability density function, shades in area under the curve, and lists the probability in the title of the graph.

  • shadePhat is similar to shadeDist but considers the distribution of only the sample proportion.

See Also

Functions plot and lm, and R-package jmuOutlier.

Examples

Run this code
# NOT RUN {
par( mfrow=c(2,2) )

# Shows P(|Z| < 1.96), where Z is standard normal.
shadeDist( c(-1,1)*qnorm(0.975), lower.tail=FALSE )

# Shows P(|T| > 1.7), where T is t distributed with 19 d.f.
shadeDist( c(-1.7, 1.7), "dt", 19, col=c("blue", "hotpink") )

# Plots distribution of Poisson(mu=6).
plotDist( "dpois", 6, xmin=0, col="seagreen", main = expression(paste("Poisson(",mu,"=6)")) )

# Graphs line of simple linear regression model and states equation.
plotLine( c(-5,6,2,9,-11), c(-7,17,21,29,8), digits.intercept=3, digits.slope=4 )

par( mfrow=c(1,1) )
# }

Run the code above in your browser using DataLab