shadow.dist: Shadows for continuous distributions

Description Usage Arguments Examples

Description

This function plots shadows for any CONTINUOUS probability distribution

Usage

1
2
3
4
shadow.dist(dist = "dnorm", param = list(mean = 0, sd = 1), a = NULL,
  b = NULL, type = "lower", col.shadow = "skyblue",
  col.line = "black", lwd = 3, nbreaks = 10000, ylab = NULL, x,
  ...)

Arguments

dist

the distribution name as 'dnorm', 'dt', 'dbeta' or any pdf available in the current session. Note: only for CONTINUOUS probability distribution.

param

is a list with the parameters of the distribution.

a

is the lower limit of the shadow area.

b

is the upper limit of the shadow area.

type

is used to define the shadow are, it could be 'lower' (by default), 'upper', 'middle' or 'two' for two tails.

col.shadow

is the shadow color, by default is 'skyblue'.

col.line

is the color line for the density.

lwd

is the line width, a positive number, defaulting to 3.

nbreaks

is the number of divisions to plot the shadow, by default is 10000.

ylab

is the y label, by default is 'Density'.

x

it is nothing.

...

Arguments to be passed to methods, such as graphical parameters (see par).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# With normal distribution
shadow.dist(dist='dnorm', param=list(mean=0, sd=1),
            a=0, b=1, type='middle', from=-3, to=3)

shadow.dist(dist='dnorm', param=list(mean=0, sd=1),
            a=0, type='lower', from=-3, to=3)

shadow.dist(dist='dnorm', param=list(mean=0, sd=1),
            b=1, type='upper', from=-3, to=3)

shadow.dist(dist='dnorm', param=list(mean=0, sd=1),
            a=0, b=1, type='two', from=-3, to=3)

# With chi-square distribution
shadow.dist(dist='dchisq', param=list(df=2),
            a=2, b=6, type='middle', from=0, to=10, col.shadow='pink')

# With t distribution
shadow.dist(dist='dt', param=list(df=2),
            a=-2, b=2, type='middle', from=-5, to=5, col.shadow='tomato')

# With beta distribution
shadow.dist(dist='dbeta', param=list(shape1=2, shape2=5),
            a=0.2, b=0.6, type='middle', nbreaks=3, main='nbreaks=3, opps!!!')

shadow.dist(dist='dbeta', param=list(shape1=2, shape2=5),
            a=0.2, b=0.6, type='middle', nbreaks=20)

fhernanb/usefultools documentation built on May 10, 2019, 8:06 a.m.