r.sample {asymmetry.measures} | R Documentation |
Switch between a range of available random number generators.
Description
Generate a random sample of size out of a range of available distributions.
Usage
r.sample(s, dist, p1=0, p2=1)
Arguments
s |
A scalar which specifies the size of the random sample drawn. |
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 user-specified argument dist
, the function returns a random sample of size from the corresponding distribution.
Supported distributions (along with the corresponding dist
values) are:
weib: The weibull distribution is implemented as
with
where
is the shape parameter and
the scale parameter.
lognorm: The lognormal distribution is implemented as
where
is the mean and
is the standard deviation of the distirbution.
norm: The normal distribution is implemented as
where
is the mean and the
is the standard deviation of the distirbution.
uni: The uniform distribution is implemented as
for
.
cauchy: The cauchy distribution is implemented as
where
is the location parameter and
the scale parameter.
fnorm: The half normal distribution is implemented as
where
and
.
normmixt:The normal mixture distribution is implemented as
where
is a mixture component(scalar) and
a vector of parameters for the mean and variance of the two mixture components
.
skewnorm: The skew normal distribution with parameter
is implemented as
.
fas: The Fernandez and Steel distribution is implemented as
where
is the p.d.f. of the
distribution with
degrees of freedom.
controls the skewness of the distribution with values between
and
denotes the degrees of freedom.
shash: The Sinh-Arcsinh distribution is implemented as
where
,
and
.
is the vector of skewness,
is the scale parameter,
is the location parameter and
the kurtosis parameter.
Value
A vector of random 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.r <- "norm" #select Normal as the distribution
shape <- 2 # specify shape parameter
scale <- 1 # specify scale parameter
n <- 100 # specify sample size
r.sample(n,selected.r,shape,scale) # calculate CDF at the designated point