| p.sample {asymmetry.measures} | R Documentation |
Switch between a range of available cumulative distribution functions.
Description
Returns the value of the selected cumulative distribution function at user supplied grid points.
Usage
p.sample(s,dist, p1,p2)
Arguments
s |
A scalar or vector: the x-axis grid points where the cumulative distribution function is be evaluated. |
dist |
Character string, used as a switch to the user selected distribution function (see details below). |
p1 |
A scalar. Parameter 1 (vector or object) of the selected distribution. |
p2 |
A scalar. Parameter 2 (vector or object) of the selected distribution. |
Details
Based on the user-specified argument dist, the function returns the value of the cumulative distribution function at s.
Supported distributions (along with the corresponding dist values) are:
weib: The Weibull distribution is implemented as
F(s) = 1 - \exp \left \{- \left ( \frac{s}{p_2} \right )^{p_1} \right \}with
s > 0wherep_1is the shape parameter andp_2the scale parameter.lognorm: The lognormal distribution is implemented as
F(s)=\Phi \left ( \frac{\ln s-p_1 }{p_2} \right )where
p_1is the mean,p_2is the standard deviation and\Phiis the cumulative distribution function of the standard normal distribution.norm: The normal distribution is implemented as
\Phi(s)={\frac {1}{\sqrt {2\pi}p_2 }}\int_{-\infty }^s e^{-\frac{(t-p_1)^2}{2p_2^2}}\,dtwhere
p_1is the mean and thep_2is the standard deviation.uni: The uniform distribution is implemented as
F(s)=\frac{s-p_1}{p_2-p_1}for
p_1 \le s \le p_2.cauchy: The cauchy distribution is implemented as
F(s;p_1,p_2)=\frac{1}{\pi}\arctan \left ( \frac{s-p_1}{p_2} \right ) + \frac{1}{2}where
p_1is the location parameter andp_2the scale parameter.fnorm: The half normal distribution is implemented as
F_S(s;\sigma)=\int_0^s \frac{\sqrt{2/\pi}}{\sigma} \exp \left \{ -\frac{x^2}{2\sigma^2} \right \} \,dxwhere
mean=0andsd=\sqrt{\pi/2}/p_1.normmixt: The normal mixture distribution is implemented as
F(s)=p_1\frac{1}{p_2[2]\sqrt{2\pi}}\int_{-\infty }^{s}e^{-\frac{(t - p_2[1])^2}{2p_2[2]^2}}\,dt + (1-p_1) \frac{1}{p_2[4]\sqrt{2\pi}} \int_{-\infty }^s e^{-\frac{(t - p2[3])^2}{2p_2[4]^2}}\,dtwhere
p_1is a mixture component(scalar) andp_2a vector of parameters for the mean and variance of the two mixture componentsp_2=c(mean1,sd1,mean2,sd2).skewnorm: The skew normal distribution is implemented as
F(y; p_1) = \Phi \left ( \frac{y-\xi}{\omega} \right )-2 T \left ( \frac{y-\xi}{\omega},p_1 \right )where
location=\xi=0,scale=\omega=1,parameter=p_1andT(h, a)is the Owens T function, defined byT(h,a) = \frac{1}{2\pi}\int_{0}^{a} \exp \left \{ \frac{- 0.5 h^2 (1+x^2) }{1+x^2} \right \} \,dx, -\infty \le h, a \le \inftyfas: The Fernandez and Steel distribution is implemented as
F(s;p_1,p_2) = \frac{2}{p_1+\frac{1}{p_1}} \left \{ \int_{-\infty}^s f_t(x/p_1; p_2)I_{\{x \ge 0\}} \,dx + \int_{-\infty}^s f_t(p_1 x; p_2)I_{\{x<0\}}\, dx \right \}where
f_t(x; \nu)is the p.d.f. of the t distribution with\nu = 5degrees of freedom.p_1controls the skewness of the distribution with values between(0, +\infty)andp_2is the degrees of freedom.shash: The Sinh-Arcsinh distribution is implemented as
F(s;\mu, p_2, p_1, \tau) =\int_{-\infty}^s \frac{ce^{-r^2/2}}{\sqrt{2\pi }} \frac{1}{p_2} \frac{1}{2} \sqrt{1+z^2}\,dzwhere
r=\sinh(\sinh(z)- p_1),c=\cosh(\sinh(z)- p_1)andz=(s-\mu)/p_2.p_1is the vector of skewness,p_2is the scale parameter,\mu=0is the location parameter and\tau=1the kurtosis parameter.
Value
A vector containing the cumulative distribution function values at the user specified points s.
Author(s)
Dimitrios Bagkavos and Lucia Gamez Gallardo
R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>
References
See Also
Examples
selected.d <- "weib" #select Weibull as the CDF
shape <- 2 # specify shape parameter
scale <- 1 # specify scale parameter
xout <- seq(0.1,5,length=50) #design point where the CDF is evaluated
p.sample(xout,selected.d,shape,scale) # calculate CDF at xout