Learn R Programming

asbio (version 0.2-1)

shade.norm: Shading functions for interpretation of pdf probabilities.

Description

Creates plots with lower, upper, two-tailed, and middle of the distribution shading for popular pdfs.

Usage

shade.norm(x = NULL, from = NULL, to = NULL, sigma = 1, mu = 0, tail = "lower", 
show.p = TRUE, show.dist = TRUE)

shade.t(x = NULL, from = NULL, to = NULL, nu = 3, tail = "lower", show.p = TRUE, 
show.dist = TRUE)

shade.F(x = NULL, from = NULL, to = NULL, nu1 = 1, nu2 = 5, tail = "lower", 
show.p = TRUE, show.dist = TRUE, prob.to.each.tail = 0.025)

shade.chi(x = NULL, from = NULL, to = NULL, nu = 1, tail = "lower", show.p = TRUE, 
show.dist = TRUE, prob.to.each.tail = 0.025)

Arguments

x
A quantile, i.e. a single number X = x.
from
To be used with tail = "middle"; the value a in $P(a < X < b)$.
to
To be used with tail = "middle"; the value b in $P(a < X < b)$.
sigma
Standard deviation for the nomral distribution.
mu
Mean of the normal distribution.
tail
One of four possibilities: "lower" provides lower tail shading, "upper" provides upper tail shading, "two" provides two tail shading, and "middle" provide shading in the middle of the pdf, between
show.p
Logical; indicating whether probabilities are to be shown.
show.dist
Logical; indicating whether parameters for the distribution are to be shown.
nu
Degrees of freedom.
nu1
Numerator degrees of freedom for the F-distribution.
nu2
Denominator degrees of freedom for the F-distribution.
prob.to.each.tail
Probability to be apportioned to each tail in the F and Chi-square distributions if tail = "two".

Value

  • Returns a plot with the requested pdf and probability shading.

Examples

Run this code
##normal
shade.norm(x=1.2,sigma=1,mu=0,tail="lower")
shade.norm(x=1.2,sigma=1,mu=0,tail="upper")
shade.norm(x=1.2,sigma=1,mu=0,tail="two")
shade.norm(from=-.4,to=0,sigma=1,mu=0,tail="middle")
shade.norm(from=0,to=0,sigma=1,mu=0,tail="middle")

##t
shade.t(x=-1,nu=5,tail="lower")
shade.t(x=-1,nu=5,tail="upper")
shade.t(x=-1,nu=5,tail="two")
shade.t(from=.5,to=.7,nu=5,tail="middle")
                                                                                        
##F
shade.F(x=2,nu1=15,nu2=8,tail="lower")
shade.F(x=2,nu1=15,nu2=8,tail="upper")
shade.F(nu1=15,nu2=8,tail="two",prob.to.each.tail=0.025)
shade.F(from=.5,to=.7,nu1=15,nu2=10,tail="middle")

##Chi.sq
shade.chi(x=2,nu=5,tail="lower")
shade.chi(x=2,nu=5,tail="upper")
shade.chi(nu=7,tail="two",prob.to.each.tail=0.025)
shade.chi(from=.5,to=.7,nu=5,tail="middle")

Run the code above in your browser using DataLab