User Tools

Site Tools


manual:tools:univariate_and_multivariate_skewness_and_kurtosis_all

List of Macros for Skewness and Kurtosis

Example data

R code

To use R, first download our R function here.

The input of the R code looks like

eclsk <- read.table('eclsk563.txt')
names(eclsk)<-c("y1", "y2", "y3", "y4")
source("mardia.r")
mardia(eclsk)

The output looks like

Sample size:  563 
Number of variables:  4 

Univariate skewness and kurtosis
      Skewness   SE_skew   Kurtosis   SE_kurt
y1  0.69321372 0.1029601  0.2295460 0.2055599
y2  0.03685117 0.1029601 -0.4178298 0.2055599
y3 -0.22527112 0.1029601 -0.2521029 0.2055599
y4 -1.00006618 0.1029601  1.2898344 0.2055599

Mardia's multivariate skewness and kurtosis
                 b          z    p-value
Skewness  2.261878 212.239506 0.00000000
Kurtosis 25.468192   2.514123 0.01193288

SAS macro

A SAS macro can be used to calculate multivariate skewness and kurtosis. We have edited this macro to get the skewness and kurtosis only.

First, download the macro to your computer, e.g., to C:\Users\johnny\. right click here to download the macro

Second, in the sas script editor, type

%inc "C:\Users\johnny\mardia.sas";
%mardia(data=testdataset, var=V2 V3)

The first line provides the sas macro file location. In the second, one needs to specify the data and variables to use.

An example is shown below

DATA eclsk;
  INFILE "eclsk563.txt";
  INPUT y1 y2 y3 y4;
RUN;
%INCLUDE "mardia.sas";
%mardia(data=eclsk, var=y1 y2 y3 y4)

The sample output looks like this

### Univariate Skewness and Kurtosis ###
 
    Skewness   SE_skew  Kurtosis   SE_kurt

y1 0.6932137 0.1029601  0.229546 0.2055599
y2 0.0368512 0.1029601  -0.41783 0.2055599
y3 -0.225271 0.1029601 -0.252103 0.2055599
y4 -1.000066 0.1029601 1.2898344 0.2055599
 
### Mardia's multivariate skewness and kurtosis ###
 
Sample size =        563
Number of variables =          4
 
Multivariate skewness
b1p =  2.2618775
z1 =  212.23951
p-value =          0
 
Multivariate kurtosis
b2p =  25.468192
z2 =   2.514123
p-value =  0.0119329

SPSS macro

An SPSS macro developed by Dr. Lawrence T. DeCarlo needs to be used. We have edited this macro to get the skewness and kurtosis only.

First, download the macro (right click here to download) to your computer under a folder such as c:\Users\johnny\.

Second, open a script editor within SPSS

spss.kurtosis.4.jpg

Third, in the script editor, type the following

get data  
 /type = txt
 /file = "C:\nonnormal\eclsk563.txt"
 /delimiters = " "
 /firstcase = 1
 /variables =
 y1 f2.0 y2 f2.0 y3 f2.0 y4 f2.0.
execute.

INCLUDE file="C:\nonnormal\mardia.sps". 
mardia vars=y1 y2 y3 y4 /. 
execute.

Note that you will need to change the folder to the SPSS macro file you just downloaded. Also, the vars to use to calculate the skewness and kurtosis should be changed to your variables.

sps.jpg

Finally, the output is shown like

Sample size:
   563

Number of variables:
     4

Univariate Skewness
         y1         y2         y3         y4    SE_skew
      .6932      .0369     -.2253    -1.0001      .1030

Univariate Kurtosis
         y1         y2         y3         y4    SE_kurt
      .2295     -.4178     -.2521     1.2898      .2056

Mardia's multivariate skewness
        b1p         z1    p-value
     2.2619   212.2395      .0000

Mardia's multivariate kurtosis
        b2p         z2    p-value
    25.4682     2.5141      .0119

Online calculator

This introduces the online tool to calculate univariate/multivariate skewness and kurtosis at http://webpower.psychstat.org/models/kurtosis/

The interface of the tool looks like

Data file

The data file can be chosen by clicking the Choose File button (it might appear differently for different browsers). We DO NOT save your data file and it is deleted immediately after calculation.

Type of data

The following types of data are allowed:

  • SPSS data file with the extension name .sav
  • SAS data file with the extension name .sas7bdat
  • Excel data file with the extension name .xls or .xlsx
  • CSV file (comma separated value data file) with extension name .csv
  • TXT file (text file) with extension name .txt

Select variables

A subset of variables can be used. To use the whole data set, leave this field blank. To select a subset of variables, provide the column numbers that separated by comma (,). For example

1, 2-5, 7-9, 11

will select variables 1, 2, 3, 4, 5, 7, 8, 9, 11

Missing data

Missing data values can be provided. If multiple values are used to denote missing data, they can be separated by comma (,). For example,

-999, -888, NA

will replace all three values above to missing data.

The output of the Web application looks like

Sample size:  563 
Number of variables:  4 

Univariate skewness and kurtosis
      Skewness   SE_skew   Kurtosis   SE_kurt
V1  0.69321372 0.1029601  0.2295460 0.2055599
V2  0.03685117 0.1029601 -0.4178298 0.2055599
V3 -0.22527112 0.1029601 -0.2521029 0.2055599
V4 -1.00006618 0.1029601  1.2898344 0.2055599

Mardia's multivariate skewness and kurtosis
                 b          z    p-value
Skewness  2.261878 212.239506 0.00000000
Kurtosis 25.468192   2.514123 0.01193288
manual/tools/univariate_and_multivariate_skewness_and_kurtosis_all.txt · Last modified: 2016/03/24 12:48 by 10.45.80.185