Description Usage Arguments Details Value Note Author(s) References Examples
Density, distribution function, quantile function and random generation for the split normal distribution with mode equal to mode, uncertainty indicator equal to sd and inverse skewness equal to skew.
1 2 3 4 | dsplitnorm(x, mode = 0, sd = 1, skew = 0, sd1 = NULL, sd2 = NULL)
psplitnorm(x, mode = 0, sd = 1, skew = 0, sd1 = NULL, sd2 = NULL)
qsplitnorm(p, mode = 0, sd = 1, skew = 0, sd1 = NULL, sd2 = NULL)
rsplitnorm(n, mode = 0, sd = 1, skew = 0, sd1 = NULL, sd2 = NULL)
|
x |
Vector of quantiles. |
p |
Vector of probabilities |
n |
Number of observations required. |
mode |
Vector of modes. |
sd |
Vector of uncertainty indicators. |
skew |
Vector of inverse skewnewss indicators. Must range between -1 and 1 |
sd1 |
Vector of standard deviations for left hand side. |
sd2 |
Vector of standard deviations for right hand side. |
If mode, sd or skew are not specified they assume the default values of 0, 1 and 1, respectively. This results in identical values as a those obtained from a normal distribution.
The probability density function is:
f(x; μ, σ_1, σ_2) = \frac{√ 2}{√π (σ_1+σ_2)} e^{-\frac{1}{2σ_1^2}(x-μ)^2}
for -Inf< x < μ, and
f(x; μ, σ_1, σ_2) = \frac{√ 2}{√π (σ_1+σ_2)} e^{-\frac{1}{2σ_2^2}(x-μ)^2}
for μ < x <Inf, where, if not specified (in sd1 and sd2) σ_1 and σ_2 are derived as
σ_1=σ/√(1-γ)
σ_2=σ/√(1+γ)
from σ_1 is the overall uncertainty indicator sd and γ is the inverse skewness indicator skew.
dsplitnorm gives the density, psplitnorm gives the distribution function, qsplitnorm gives the quantile function, and rsplitnorm generates random deviates.
The length of the result is determined by n for rsplitnorm, and is the maximum of the lengths of the numerical parameters for the other functions.
The numerical parameters other than n are recycled to the length of the result.
Tested against the fan chart package in MATLAB (http://www.mathworks.de/matlabcentral/fileexchange/27702-fan-chart). Obtained the same results for a set of simple comparisons.
Guy J. Abel
Source for all functions based on:
Julio, J. M. (2007). The Fan Chart: The Technical Details Of The New Implementation. Bogota, Colombia. Retrieved from http://www.banrep.gov.co/docum/ftp/borra468.pdf
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 28 | x<-seq(-5,5,length=110)
plot(x,dsplitnorm(x),type="l")
#compare to normal density
lines(x,dnorm(x), lty=2, col="red", lwd=5)
#add positive skew
lines(x,dsplitnorm(x, mode=0, sd=1, skew=0.8))
#add negative skew
lines(x,dsplitnorm(x, mode=0, sd=1, skew=-0.5))
#add left and right hand sd
lines(x,dsplitnorm(x, mode=0, sd1=1, sd2=2), col="blue")
#psplitnorm
x<-seq(-5,5,length=100)
plot(x,pnorm(x),type="l")
lines(x, psplitnorm(x, skew=-0.9), col="red")
#qsplitnorm
x<-seq(0,1,length=100)
plot(qnorm(x),type="l",x)
lines(qsplitnorm(x), x, lty=2, col="blue")
lines(qsplitnorm(x, skew=-0.3), x, col="red")
#rsplitnorm
hist(rsplitnorm(n=10000, mode=1, sd=1, skew=0.9),100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.