Description Usage Arguments Details Value Note Author(s) See Also Examples
Calcule theoretical skewness of any continuous or discrete distribution.
1 |
dist |
density or mass name for the distribution. The created density or mass functions must have a name of the form |
param |
are the parameters of the distribution. The name of each parameter must be specified. To understand its use see examples. |
domain |
defines the domain of the distribution function. The type of domain of distribution to be tried see details. |
The skew
function supports probability distribution functions of a large number of libraries.
In the dist
argument, you must enter the name of the distribution of interest, for example, you can enter "gamma"
or "dgamma"
, both will produce the same result.
If f(x) has no parameters, then do param = NULL
.
The following are the different domain
argument:
binom
: for discrete distributions of binomial type.
counts
: for discrete distributions of counting type.
realline
: for continuous distributions defined between -∞ and ∞.
realplus
: for continuous distributions defined between 0 and ∞.
real0to1
: for continuous distributions defined between 0 and 1.
real-1to1
: for continuous distributions defined between -1 and 1.
c(lower = a, upper = b)
: for continuous distributions defined between a
and b
.
skew
gives the theorical skewness of any continuous or discrete probability distribution function.
Many continuous distributions support domain = "realline"
even though they are not defined from -∞ to ∞ because of their programming.
In the same way, many discrete distributions support domain = "counts"
even though they are not defined from 0 to ∞ or 1 to ∞ because of their programming.
It is recommended to try initially with this argument.
Discrete distributions require the existence of the quantile function, of the form qxxx.
Jorge Iván Pérez, jivan.perez@udea.edu.co
Distributions
for other standard distributions.
Distributions
for other standard distributions.
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # Let's try first with distributions of the library stats
skew(dist = "dchisq", param = c(df = 3), domain = "realplus")
# or
skew(dist = "chisq", param = c(df = 4), domain = "realplus")
#---------------------------------------------------------------------------------------
# The name of the created density functions must have a name
# of the form dxxx. Also, how does it not have parameters
# then param = NULL
dmyfunction <- function(x) x^3/4
# so that it integrates to 1, x must be between 0 to 2.
skew(dist = "dmyfunction", param = NULL, domain = c(0, 2))
#---------------------------------------------------------------------------------------
# Let's try distributions from other libraries
if(!require("extraDistr")) install.packages("extraDistr") # to install the package
# The same result is obtained with the diferent domain (see 'Note')
skew(dist = "dpareto", param = c(a = 4, b = 10),
domain = "realline")
# In this case, no moments are calculated for k> 3, because the
# parameter of the pareto distribution is a = 4, and
# therefore, the moments are defined for E(X^k) < a.
# Read about pareto distribution for more information.
skew(dist = "dbhatt", param = c(mu = 3, sigma = 7),
domain = "realline")
#---------------------------------------------------------------------------------------
# Let's try distributions from other libraries
if(!require("gamlss.dist")) install.packages("gamlss.dist") # to install the package
skew(dist = "PE", param = c(mu = -25, sigma = 7, nu = 4),
domain = "realline")
skew(dist = "BEOI", param = c(mu = 0.3, sigma = 7, nu = 0.3),
domain = "real0to1")
skew(dist = "BCT", param = c(mu = 12, sigma = 0.2, nu = 3,
tau = 5), domain = "realplus")
skew(dist = "SEP2", param = c(mu = 0.5, sigma = 3,
nu = 0, tau = 5), domain = "realline")
#---------------------------------------------------------------------------------------
# Let's try with a discrete counting distribution
if(!require("gamlss.dist")) install.packages("gamlss.dist") # to install the package
skew(dist = "DEL", param = c(mu = 2, sigma = 3, nu = 0.5),
domain = "counts")
skew(dist = "NBF", param = c(mu = 4, sigma = 3, nu = 2),
domain = "counts")
#---------------------------------------------------------------------------------------
# Let's try with a discrete binomial type distribution
skew(dist = "binom", param = c(size = 15, prob = 0.3),
domain = "binom")
skew(dist = "dhyper", param = c(m = 10, n = 7, k = 8),
domain = "binom")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.