Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/Functions_for_SK_in_gamlss.R

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.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
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)
``` |

`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 |

`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 |

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

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 |

`trans.S0.25:` |
sample centile transformed central skewness |

`trans.S0.01:` |
sample centile transformed tail skewness |

`K0.01:` |
sample centile kurtosis |

`standK0.01:` |
standardise centile kurtosis, ( |

`exc.K0.01:` |
excess centile kurtosis, ( |

`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 |

`tSp:` |
sample transformed centile skewness at |

The function `centileKurt()`

for a given argument `p`

produces:

`p` |
the value determiming the centile kurtosis |

`Kp` |
sample centile kurtosis at |

`sKp` |
sample standardise centile kurtosis at |

`ex.Kp:` |
sample excess centile kurtosis at |

`teKp:` |
sample transformed excess centile kurtosis at |

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 standardise centile kurtosis of the distribution |

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

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. An older version can be found in http://www.gamlss.com/.

1 2 3 4 5 6 7 8 9 10 11 12 | ```
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)
checkMomentSK(Y)
checkCentileSK(Y)
#checkCentileSK(Y, type="tail")
``` |

```
Loading required package: MASS
$mom.skew
[1] 0.7689419
$trans.mom.skew
[1] 0.4346903
$mom.kurt
[1] 3.443498
$excess.mom.kurt
[1] 0.4434982
$trans.mom.kurt
[1] 0.3072385
$jarque.bera.test
[1] 106.7407
$S0.25
0.05001109
$S0.01
0.3536951
$trans.S0.25
0.04762911
$trans.S0.01
0.2612812
$K0.01
3.237185
$standK0.01
0.9385867
$exc.K0.01
-0.2118146
$trans.K0.01
-0.1747912
$p
[1] 0.2
$Sp
0.0773281
$tSp
0.07177767
$p
[1] 0.3
$Kp
0.7874979
$sKp
0.2283265
$ex.Kp
-2.661502
$teKp
-0.726888
$IR
[1] 0.5395878
$SIR
[1] 0.2697939
$S_0.25
[1] -0.06473032
$S_0.01
[1] -0.2317742
$K_0.01
[1] 3.746159
$sK_0.01
[1] 1.086143
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.