Learn R Programming

psych (version 1.0-97)

mardia: Calculate univariate or multivariate (Mardia's test) skew and kurtosis for a vector, matrix, or data.frame

Description

Find the skew and kurtosis for each variable in a data.frame or matrix. Unlike skew and kurtosis in e1071, this calculates a different skew for each variable or column of a data.frame/matrix. mardia applies Mardia's tests for multivariate skew and kurtosis

Usage

skew(x, na.rm = TRUE)
kurtosi(x, na.rm = TRUE,type=1)
mardia(x,na.rm = TRUE,plot=TRUE)

Arguments

x
A data.frame or matrix
na.rm
how to treat missing data
type
type=1 gives an unbiased estimate of kurtosis, type 2 gives a biased estimate
plot
Plot the expected normal distribution values versus the Mahalanobis distance of the subjects.

Value

  • skewif input is a matrix or data.frame, skew is a vector of skews
  • kurtosiif input is a matrix or data.frame, kurtosi is a vector of kurtosi
  • bp1Mardia's bp1 estimate of multivariate skew
  • bp2Mardia's bp2 estimate of multivariate kurtosis
  • skewMardia's skew statistic
  • small.skewMardia's small sample skew statistic
  • p.skewProbability of skew
  • p.smallProbability of small.skew
  • kurtosisMardia's multivariate kurtosis statistic
  • p.kurtosisProbability of kurtosis statistic
  • DMahalanobis distance of cases from centroid

Details

given a matrix or data.frame x, find the skew or kurtosis for each column (for skew and kurtosis) or the multivariate skew and kurtosis in the case of mardia.

As of revision 1.0.93, kurtosi by default gives an unbiased estimate of the kurtosis (DeCarlo, 1997). Prior versions used a different equation which produced a biased estimate. (See the kurtosis function in the e1071 package for the distinction between these two formulae. The default, type 1 is what is called type 2 in e1071. The other is their type 3.) For comparison with previous releases, specifying type = 2 will give the old estimate.

References

L.DeCarlo. 1997) On the meaning and use of kurtosis, Psychological Methods, 2(3):292-307,

K.V. Mardia (1970). Measures of multivariate skewness and kurtosis with applications. Biometrika, 57(3):pp. 519-30, 1970.

See Also

describe, describe.by, mult.norm in QuantPsyc, Kurt in QuantPsyc

Examples

Run this code
round(skew(attitude),2)
round(kurtosi(attitude),2)
mardia(attitude)
x <- matrix(rnorm(1000),ncol=10)
describe(x)
mardia(x)

Run the code above in your browser using DataLab