Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Moments, Cumulants, Skewness, Kurtosis and Related Tests, Study notes of Statistics

Statistical Cumulants. Description. This function calculates the cumulants for all orders specified in the given vector, matrix or data frame of raw moments.

Typology: Study notes

2021/2022

Uploaded on 09/27/2022

little_rachel
little_rachel 🇬🇧

4.7

(6)

217 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Package ‘moments’
May 2, 2022
Type Package
Title Moments, Cumulants, Skewness, Kurtosis and Related Tests
Version 0.14.1
Date 2015-01-05
Author Lukasz Komsta <lukasz.komsta@umlub.pl>, Frederick Novomestky
<fnovomes@poly.edu>
Maintainer Lukasz Komsta <lukasz.komsta@umlub.pl>
Description Functions to calculate: moments, Pearson's kurtosis,
Geary's kurtosis and skewness; tests related to them
(Anscombe-Glynn, D'Agostino, Bonett-Seier).
License GPL (>= 2)
URL https://www.r-project.org,http://www.komsta.net/
NeedsCompilation no
Repository CRAN
Date/Publication 2022-05-02 13:01:55 UTC
Rtopics documented:
agostino.test......................................... 2
all.cumulants ........................................ 3
all.moments......................................... 4
anscombe.test........................................ 5
bonett.test.......................................... 6
central2raw ......................................... 8
geary ............................................ 9
jarque.test.......................................... 10
kurtosis ........................................... 11
moment ........................................... 11
raw2central ......................................... 12
skewness .......................................... 13
Index 15
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Moments, Cumulants, Skewness, Kurtosis and Related Tests and more Study notes Statistics in PDF only on Docsity!

Package ‘moments’

May 2, 2022

Type Package

Title Moments, Cumulants, Skewness, Kurtosis and Related Tests

Version 0.14.

Date 2015-01-

Author Lukasz Komsta lukasz.komsta@umlub.pl, Frederick Novomestky

fnovomes@poly.edu

Maintainer Lukasz Komsta lukasz.komsta@umlub.pl

Description Functions to calculate: moments, Pearson's kurtosis, Geary's kurtosis and skewness; tests related to them (Anscombe-Glynn, D'Agostino, Bonett-Seier).

License GPL (>= 2)

URL https://www.r-project.org, http://www.komsta.net/

NeedsCompilation no

Repository CRAN

Date/Publication 2022-05-02 13:01:55 UTC

R topics documented:

agostino.test......................................... 2 all.cumulants........................................ 3 all.moments......................................... 4 anscombe.test........................................ 5 bonett.test.......................................... 6 central2raw......................................... 8 geary............................................ 9 jarque.test.......................................... 10 kurtosis........................................... 11 moment........................................... 11 raw2central......................................... 12 skewness.......................................... 13

Index 15

2 agostino.test

agostino.test D’Agostino test of skewness

Description

Performs D’Agostino test for skewness in normally distributed data.

Usage

agostino.test(x, alternative = c("two.sided", "less", "greater"))

Arguments

x a numeric vector of data values. alternative a character string specifying the alternative hypothesis, must be one of ’"two.sided"’ (default), ’"greater"’ or ’"less"’. You can specify just the initial letter.

Details

Under the hypothesis of normality, data should be symmetrical (i.e. skewness should be equal to zero). This test has such null hypothesis and is useful to detect a significant skewness in normally distributed data.

Value

A list with class htest containing the following components:

statistic the list containing skewness estimator and its transformation. p.value the p-value for the test. alternative a character string describing the alternative hypothesis. method a character string indicating what type of test was performed. data.name name of the data argument.

Author(s)

Lukasz Komsta

References

D’Agostino, R.B. (1970). Transformation to Normality of the Null Distribution of G1. Biometrika, 57, 3, 679-681.

See Also

skewness

4 all.moments

Examples

set.seed(1234) x <- rnorm(10000) mu.raw.x <- all.moments( x, order.max=6 ) all.cumulants( mu.raw.x ) M <- matrix( x, nrow=1000, ncol=10 ) mu.raw.M <- all.moments( M, order.max=6 ) all.cumulants( mu.raw.M ) D <- data.frame( M ) mu.raw.D <- all.moments( D, order.max=6 ) all.cumulants( mu.raw.D )

all.moments Statistical Moments

Description

This function computes all the sample moments of the chosen type up to a given order.

Usage

all.moments(x, order.max = 2, central = FALSE, absolute = FALSE, na.rm = FALSE)

Arguments

x A numeric vector, matrix or data frame of data. For matrices and data frames, each column is a random variable order.max the maximum order of the moments to be computed with a default value of 2. central a logical value, if TRUE, central moments are computed. Otherwise, raw mo- ments are computed absolute a logical value, if TRUE, absolute moments are computed. Otherwise, standard moments are computed na.rm a logical value, if TRUE, remove NA values. Otherwise, keep NA values

Details

The minimum value for order.max is 2. The function stops running for values less than 2 and the message "maximum order whould be at least 2" is displayed on standard output.

Value

A vector, matrix or data frame of moments depending on the nature of the argument x. If x is a vector, then the value returned is a vector, say mu, where mu[1] is the order 0 moment, mu[2] is the order 1 moment and so forth. If x is a matrix or data frame, then the value returned is a matrix or data frame, respectively. In this case, suppose mu is the value returned. Then, row vector mu[1,] contains the order 0 moments, mu[2,] contains the order 1 moments and so forth.

anscombe.test 5

Author(s)

Frederick Novomestky fnovomes@poly.edu

References

Papoulis, A., Pillai, S. U. (2002) Probability, Random Variables and Stochastic Processes, Fourth Edition, McGraw-Hill, New York, 146-147.

See Also

moment, raw2central

Examples

set.seed(1234) x <- rnorm(10000) all.moments( x, order.max=4 ) all.moments( x, central=TRUE, order.max=4 ) all.moments( x, absolute=TRUE, order.max=4 ) all.moments( x, central=TRUE, absolute=TRUE, order.max=4 ) M <- matrix( x, nrow=1000, ncol=10 ) all.moments( M, order.max=4 ) all.moments( M, central=TRUE, order.max=4 ) all.moments( M, absolute=TRUE, order.max=4 ) all.moments( M, central=TRUE, absolute=TRUE, order.max=4 ) D <- data.frame( M ) all.moments( D, order.max=4 ) all.moments( D, central=TRUE, order.max=4 ) all.moments( D, absolute=TRUE, order.max=4 ) all.moments( D, central=TRUE, absolute=TRUE, order.max=4 )

anscombe.test Anscombe-Glynn test of kurtosis

Description

Performs Anscombe-Glynn test of kurtosis for normal samples

Usage

anscombe.test(x, alternative = c("two.sided", "less", "greater"))

Arguments

x a numeric vector of data values. alternative a character string specifying the alternative hypothesis, must be one of ’"two.sided"’ (default), ’"greater"’ or ’"less"’. You can specify just the initial letter.

bonett.test 7

Arguments

x a numeric vector of data values. alternative a character string specifying the alternative hypothesis, must be one of ’"two.sided"’ (default), ’"greater"’ or ’"less"’. You can specify just the initial letter.

Details

Under the hypothesis of normality, data should have Geary’s kurtosis equal to sqrt(2/pi) (0.7979). This test has such null hypothesis and is useful to detect a significant difference of Geary’s kurtosis in normally distributed data.

Value

A list with class htest containing the following components:

statistic the list containing Geary’s kurtosis estimator and its transformation. p.value the p-value for the test.

alternative a character string describing the alternative hypothesis. method a character string indicating what type of test was performed. data.name name of the data argument.

Author(s)

Lukasz Komsta

References

Bonett, D.G., Seier, E. (2002) A test of normality with high uniform power. Computational Statis- tics and Data Analysis, 40, 435-445.

See Also

geary

Examples

set.seed(1234) x = rnorm(1000) geary(x) bonett.test(x)

8 central2raw

central2raw Central to raw moments

Description

This function transforms a vector, matrix or data frame of central moments to a vector, matrix or data frame of raw moments.

Usage

central2raw(mu.central,eta)

Arguments

mu.central A numeric vector, matrix or data frame of central moments. For a vector, mu.central[0] is the order 0 central moment, mu.central[1] is the order 1 cen- tral moment and so forth. For a matrix or data frame, row vector mu.central[0,] contains the order 0 central moments, row vector mu.central[1,] contains the order 1 central moments and so forth. eta A numeric vector of sample mean or expected values

Value

A vector matrix or data frame of raw moments. For matrices and data frame, column vectors correspond to different random variables.

Author(s)

Frederick Novomestky fnovomes@poly.edu

References

Papoulis, A., Pillai, S. U. (2002) Probability, Random Variables and Stochastic Processes, Fourth Edition, McGraw-Hill, New York, 146-147.

See Also

moment, all.moments, raw2central

Examples

set.seed(1234) x <- rnorm(10000) mu.raw.x <- all.moments( x, order.max=4 ) eta.x <- mu.raw.x[2] mu.central.x <- all.moments( x, central=TRUE, order.max=4 ) central2raw( mu.central.x, eta.x ) mu.raw.x

10 jarque.test

Examples

set.seed(1234) geary(rnorm(1000))

jarque.test Jarque-Bera test for normality

Description

This function performs the Jarque-Bera test on the given data sample to determine if the data are sample drawn from a normal population.

Usage

jarque.test(x)

Arguments

x a numeric vector of data

Details

Under the hypothesis of normality, data should be symmetrical (i.e. skewness should be equal to zero) and have skewness chose to three. The Jarque-Bera statistic is chi-square distributed with two degrees of freedom.

Value

A list with class htest containing the following components:

statistic the list containing the Jarque-Bera statistic p.value the p-value for the test. alternative a character string describing the alternative hypothesis. method a character string indicating what type of test was performed. data.name name of the data argument.

Author(s)

Frederick Novomestky fnovomes@poly.edu

References

Jarque, C. M., Bera, A. K. (1980) Efficient test for normality, homoscedasticity and serial indepen- dence of residuals, Economic Letters, Vol. 6 Issue 3, 255-259.

kurtosis 11

Examples

set.seed( 1234 ) x <- rnorm( 1000 ) jarque.test( x )

kurtosis Pearson’s measure of kurtosis

Description

This function computes the estimator of Pearson’s measure of kurtosis.

Usage

kurtosis(x, na.rm = FALSE)

Arguments

x a numeric vector, matrix or data frame. na.rm logical. Should missing values be removed?

Author(s)

Lukasz Komsta

See Also

geary, anscombe.test

Examples

set.seed(1234) kurtosis(rnorm(1000))

moment Statistical Moments

Description

This function computes the sample moment of specified order.

Usage

moment(x, order = 1, central = FALSE, absolute = FALSE, na.rm = FALSE)

skewness 13

References

Papoulis, A., Pillai, S. U. (2002) Probability, Random Variables and Stochastic Processes, Fourth Edition, McGraw-Hill, New York, 146-147.

See Also

moment, all.moments, central2raw

Examples

set.seed(1234) x <- rnorm(10000) mu.raw.x <- all.moments( x, order.max=4 ) mu.central.x <- all.moments( x, central=TRUE, order.max=4 ) raw2central( mu.raw.x ) mu.central.x M <- matrix( x, nrow=1000, ncol=10 ) mu.raw.M <- all.moments( M, order.max=4 ) mu.central.M <- all.moments( M, central=TRUE, order.max=4 ) raw2central( mu.raw.M ) mu.central.M D <- data.frame( M ) mu.raw.D <- all.moments( D, order.max=4 ) mu.central.D <- all.moments( D, central=TRUE, order.max=4 ) raw2central( mu.raw.D ) mu.central.D

skewness Skewness of the sample

Description

This function computes skewness of given data.

Usage

skewness(x, na.rm = FALSE)

Arguments

x a numeric vector, matrix or data frame. na.rm logical. Should missing values be removed?

Author(s)

Lukasz Komsta

14 skewness

See Also

agostino.test

Examples

set.seed(1234) skewness(rnorm(1000))