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 > 0
wherep_1
is the shape parameter andp_2
the scale parameter.lognorm: The lognormal distribution is implemented as
F(s)=\Phi \left ( \frac{\ln s-p_1 }{p_2} \right )
where
p_1
is the mean,p_2
is the standard deviation and\Phi
is 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}}\,dt
where
p_1
is the mean and thep_2
is 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_1
is the location parameter andp_2
the 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 \} \,dx
where
mean=0
andsd=\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}}\,dt
where
p_1
is a mixture component(scalar) andp_2
a 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_1
andT(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 \infty
fas: 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 = 5
degrees of freedom.p_1
controls the skewness of the distribution with values between(0, +\infty)
andp_2
is 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}\,dz
where
r=\sinh(\sinh(z)- p_1)
,c=\cosh(\sinh(z)- p_1)
andz=(s-\mu)/p_2
.p_1
is the vector of skewness,p_2
is the scale parameter,\mu=0
is the location parameter and\tau=1
the 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