The functions `momentSK()`

, `centileSK()`

, `centileSkew()`

and `centileKurt()`

, calculate sample statistics related to skewness and kurtosis. The function `theoCentileSK()`

calculates the theoretical centile statistics from a given `gamlss.family`

distribution. The `plotCentileSK()`

plots the theoretical centile skewness and kurtosis against `p`

(see below).

The function `checkMomentSK()`

can be use to check (a) whether the moment skewness and kurtosis of a fitted model are modelled adequantly (the residuals of the model are used). (b) whether a given sample display skewness or kurtosis.

```
momentSK(x, weights=NULL)
centileSK(x, cent = c(1, 25), weights=NULL)
centileSkew(x, cent = 1, weights=NULL)
centileKurt(x, cent = 1, weights=NULL)
```theoCentileSK(fam = "NO", p = 0.01, ...)
plotCentileSK(fam = "NO", plotting = c("skew", "kurt", "standKurt"),
add = FALSE, col = 1, lty = 1, lwd = 1, ylim = NULL, ...)
checkMomentSK(x, weights=NULL, add = FALSE, bootstrap = TRUE, no.bootstrap = 99,
col.bootstrap = "lightblue", pch.bootstrap = 21,
asCharacter = TRUE, col.point = "black", pch.point = 4,
lwd.point = 2, text.to.show = NULL, cex.text = 1.5,
col.text = "black", show.legend = TRUE)
checkCentileSK(x,weights=NULL, type = c("central", "tail"), add = FALSE,
bootstrap = TRUE, no.bootstrap = 99,
col.bootstrap = "lightblue", pch.bootstrap = 21,
asCharacter = TRUE, col.point = "black", pch.point = 4,
lwd.point = 2, text.to.show = NULL, cex.text = 1.5,
col.text = "black", show.legend = TRUE)

Different functions produce different output:
The function `momentSK()`

produce:

- mom.skew:
sample moment skewness

- trans.mom.skew:
sample transformed moment skewness

- mom.kurt:
sample moment kurtosis

- excess.mom.kurt:
sample excess moment kurtosis

- trans.mom.kurt:
sample ransformed moment excess kurtosis

- jarque.bera.test:
the value of the Jarque-bera test for testing whether skewness and excess kurtosis are zero or not

The function `centileSK()`

produces:

- S0.25:
sample centile central skewness

- S0.01:
sample centile tail skewness

- K0.01:
sample centile kurtosis

- standK0.01:
standardised centile kurtosis, (

`K0.01/3.449`

)- exc.K0.01:
excess centile kurtosis, (

`K0.01-3.449`

)- trans.K0.01:
transfored excess centile kurtosis, (exc.K0.01/(1+abs(exc.K0.01))

The function `centileSkew()`

for a given argument `p`

produces:

- p:
the value determiming the centile skewness

- Sp:
sample centile skewness at

`p`

The function `centileKurt()`

for a given argument `p`

produces:

- p
the value determiming the centile kurtosis

- Kp
sample centile kurtosis at

`p`

- sKp
sample standardised centile kurtosis at

`p`

- ex.Kp:
sample excess centile kurtosis at

`p`

- teKp:
sample transformed excess centile kurtosis at

`p`

The function `theoCentileSK`

for a given `gamlss.family`

produces:

- IR
the interquartile range of the distribution

- SIR
the semi interquartile range of the distribution

- S_0.25
the central skewness of the distribution

- S_0.01:
the tail skewness of the distribution

- K_0.01:
the centile kurtosis of the distribution

- sK_0.01:
the standardised centile kurtosis of the distribution

- x
data vector or gamlss model

- weights
prior weights for the x

- cent
the centile required

- type
For centile skewness and kurtosis only whether "central" (default) or "tail")

- fam
A gamlss distribution family

- plotting
what to plot

- add
whether to add the line to the existing plot

- col
the colour of the line

- lty
the type of the line

- lwd
the width of the line

- ylim
the y limit of the graph

- p
the value determiming the centile skewness or kurtosis

- ...
additional arguments pass to

`theoCentileSK()`

function i.e. the values of the distribution parameters- bootstrap
whether a plot of the bootstrap skewness and kurtosis measures should be added in the plot

- no.bootstrap
the number of boostrap skewness and kurtosis measures

- col.bootstrap
the coloue for boostraps

- pch.bootstrap
the point type of boostraps

- asCharacter
whether to plot the estimated skewness and kurtosis measure as character or as point

- col.point
the colour of the skewness and kurtosis measure

- pch.point
the point type of the skewness and kurtosis measure

- lwd.point
the width of the plotted point

- text.to.show
to display text different from variable or model

- cex.text
the size of the text

- col.text
the colour of the text

- show.legend
whether to show the legent

Mikis Stasinopoulos, Bobert Rigby, Gillain Heller and Fernanda De Bastiani.

Those function calculate sample moment and centile skewness and kurtosis statistics and theoretical centile values for a specific distribution.

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape, (with discussion),
*Appl. Statist.*, **54**, part 3, pp 507-554.

Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019)
*Distributions for modeling location, scale, and shape: Using GAMLSS in R*, Chapman and Hall/CRC, tools:::Rd_expr_doi("10.1201/9780429298547"). An older version can be found in https://www.gamlss.com/.

Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R.
*Journal of Statistical Software*, Vol. **23**, Issue 7, Dec 2007, tools:::Rd_expr_doi("10.18637/jss.v023.i07").

Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017)
*Flexible Regression and Smoothing: Using GAMLSS in R*, Chapman and Hall/CRC. tools:::Rd_expr_doi("10.1201/b21973")

(see also https://www.gamlss.com/).

`gamlss.family`

```
Y <- rSEP3(1000)
momentSK(Y)
centileSK(Y)
centileSkew(Y, cent=20)
centileKurt(Y, cent=30)
theoCentileSK("BCCG", mu=2, sigma=.2, nu=2)
plotCentileSK(fam="BCCG", mu=2, sigma=.2, nu=2)
# \donttest{
checkMomentSK(Y)
checkCentileSK(Y)
checkCentileSK(Y, type="tail")# }
```

Run the code above in your browser using DataLab