Fast Drawing and Shading of Graphs of Statistical Distributions
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.
plotDistdraws as many as three probability density functions or cumulative distribution functions on the same graph.
shadeDistdraws a probability density function, shades in area under the curve, and lists the probability in the title of the graph.
shadePhatis similar to
shadeDistbut considers the distribution of only the sample proportion.
plotLineperforms a simple scatter plot, fits the linear regression line, and states the equation of the line in the title.
getMinMaxis called by both
shadeDistfor determining a reasonable domain for plotting the graph.
Steven T. Garren, James Madison University, Harrisonburg, Virginia, USA; GARRENST AT JMU DOT EDU
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# Plots cumulative distribution functions of a standard normal, a central t with 4 d.f., # and a t with 4 d.f. and non-centrality parameter = 1.3 in black, red, and green, respectively. plotDist( "pnorm", 0, 1, "pt", 4, 0, "pt", 4, 1.3 ) # Plots Binomial(n=100,p) density functions, where p=0.4, 0.5, and 0.7 # in colors black, red, and green, respectively. plotDist( "dbinom", 100, 0.4, "dbinom", 100, 0.5, "dbinom", 100, 0.7 ) # Shows P(|T| > 1.8), where T is t distributed with 9 d.f. shadeDist( c(-1.8, 1.8), "dt", 9 ) # Shows P(X > 8), where X ~ Poisson(mean=6). shadeDist( 8, "dpois", 6, lower.tail=FALSE, col=c("purple","green") ) # 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 ) # Finds a reasonable domain when plotting a Normal(mean=20, sd=5) density function. getMinMax( , , "dnorm", 20, 5 )
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.