RATS 11.1
RATS 11.1

Instructions /

STATISTICS Instruction

Home Page

← Previous Next →

STATISTICS( options )       series start end

STATISTICS computes sample statistics (and optionally sample quantiles) for a single series. Use TABLE to compute basic statistics on several series at the same time.

Wizard

The STATISTICS instruction can be generated by using the Statistics>Univariate Statistics Wizard and choosing the "Basic Statistics" option.

Parameters

series

series to analyze

start, end

range of series to use. By default, the defined range of series.

Options

[PRINT]/NOPRINT

TITLE="title for output" ["Statistics on Series xxxx"]

Use NOPRINT to suppress the output. Use TITLE to supply your own title to label the resulting output.

 

SMPL=Standard SMPL option [unused]

 

SHUFFLE=SERIES[INTEGER] with entry remapping[unused]

 

WEIGHT=Standard WEIGHT option [unused]

Use this option if you want to provide different weights for each observation.

 

[CENTER]/NOCENTER

NOCENTER can be used if a mean of zero is assumed—it uses variants on the calculations which don't include subtracting off an unknown mean.

 

[MOMENTS]/NOMOMENTS

By default, STATISTICS computes the following:

 

sample mean, variance and standard error

test for \(\mu  = 0\)

skewness

(excess) kurtosis

Jarque–Bera (1987) normality test

 

The skewness and kurtosis statistics include a test of the null hypotheses that each is zero (the population values if series is i.i.d. Normal.) Jarque–Bera is a test for normality based upon the skewness and kurtosis measures combined. We list the formulas for these in “Technical Information”.

 

If you want only the fractiles (quantiles) and not these moment-based statistics, use the option NOMOMENTS.

 

FRACTILES/[NOFRACTILES]

If you use the FRACTILES option, STATISTICS computes the maximum, minimum, median and a number of other sample fractiles (1%, 5%, 10%, 25%, 75%, 90%, 95% and 99%).

 

WINDOW="title of window"

If you use the WINDOW option, the output goes to a Report Window with the given title, rather than being inserted into the output window or file as text. Note that even without the WINDOW option, you can reload the report from the Reports Windows list on the Window menu.

Notes

RATS has a number of other related instructions which you may find useful. SSTATS computes statistics on one or more general formulas. EXTREMUM computes the maximum and minimum values only. MVSTATS computes means, variances, and various quantiles for a moving window on a series.

Variables Defined

%MEAN

sample mean (REAL)

%VARIANCE

sample variance (REAL)

%NOBS

number of observations (INTEGER)

%CDSTAT

test statistic for mean zero (REAL)

%SIGNIF

significance level of zero mean test (REAL)

%SKEWNESS

skewness (REAL)

%KURTOSIS

(excess) kurtosis (REAL)

%JBSTAT

Jarque–Bera statistic (REAL)

%JBSIGNIF

Significance level of %JBSTAT (REAL)

Variables Defined (with FRACTILES option)

%MINIMUM

minimum value (REAL)

%MAXIMUM

maximum value (REAL)

%MEDIAN

median (REAL)

%FRACT01

1%-ile  (REAL)

%FRACT05

5%-ile  (REAL)

%FRACT10

10%-ile  (REAL)

%FRACT25

25%-ile  (REAL)

%FRACT75

75%-ile  (REAL)

%FRACT90

90%-ile  (REAL)

%FRACT95

95%-ile  (REAL)

%FRACT99

99%-ile  (REAL)

Examples

*

* ExampleFive.RPF

*

open data wages1.dat

data(format=prn,org=columns) 1 3294 exper male school wage

*

* Do basic statistics on the two subsamples. The first is where "male" is

* non-zero, the second where .not.male is non-zero, that is, where male

* itself is zero.

*

stats(smpl=male) wage

stats(smpl=.not.male) wage



 

*

* Replication file for West and Cho(1995), "The predictive ability of

* several models of exchange rate volatility," Journal of Econometrics,

* vol. 69, no 2, 367-391.

*

* Table 1. Summary statistics.

*

open data westcho_xrate.xls

calendar(w) 1973:3:7

data(format=xls,org=col) 1973:03:07 1989:09:20 scan sfra sger sita sjap sukg

*

set xcan = 100.0*(scan-scan{1})

set xfra = 100.0*(sfra-sfra{1})

set xger = 100.0*(sger-sger{1})

set xita = 100.0*(sita-sita{1})

set xjap = 100.0*(sjap-sjap{1})

set xukg = 100.0*(sukg-sukg{1})

*

compute s=xcan

stats(fractiles) s

Sample Output

This is the output from the second example, which includes both the moment statistics and the quantiles.

 

Statistics on Series XCAN

Weekly Data From 1973:03:14 To 1989:09:20

Observations                   863

Sample Mean              -0.019685      Variance                   0.305073

Standard Error            0.552334      SE of Sample Mean          0.018802

t-Statistic (Mean=0)     -1.046990      Signif Level (Mean=0)      0.295398

Skewness                 -0.424093      Signif Level (Sk=0)        0.000000

Kurtosis (excess)         5.016541      Signif Level (Ku=0)        0.000000

Jarque-Bera             930.785103      Signif Level (JB=0)        0.000000

 

Minimum                  -4.163577      Maximum                    2.550450

01-%ile                  -1.355367      99-%ile                    1.375713

05-%ile                  -0.872448      95-%ile                    0.871059

10-%ile                  -0.643904      90-%ile                    0.600986

25-%ile                  -0.312179      75-%ile                    0.276547

Median                   -0.029924

Technical Information

The skewness and kurtosis formulas and the test statistics based upon them are from Kendall and Stuart (1958).


 

For the sample \({X_1},{X_2}, \ldots ,{X_N}\):


 

Mean (\(\bar X\))

\(\frac{1}{N}\sum\limits_{i = 1}^N {{X_i}} \)

Variance (\({s^2}\))

\(\frac{1}{{N - 1}}\sum\limits_{i = 1}^N {{{\left( {{X_i} - \bar X} \right)}^2}} \)

Standard Error of Mean

\(\frac{s}{{\sqrt N }}\)

t-statistic for mean=0

\(\frac{{\bar X\sqrt N }}{s}\)

\({m_k}\) (used below)

\(\frac{1}{N}\sum\limits_{i = 1}^N {{{\left( {{X_i} - \bar X} \right)}^k}} \)

Skewness (Sk)

\(\frac{{{N^2}}}{{\left( {N - 1} \right)\left( {N - 2} \right)}}\frac{{{m_3}}}{{{s^3}}}\)

Sk=0 statistic

\(z = Sk{\kern 1pt} {\kern 1pt} \sqrt {\frac{{\left( {N - 1} \right)\left( {N - 2} \right)}}{{6N}}} \)

Kurtosis (Ku)

\(\frac{{{N^2}}}{{\left( {N - 1} \right)\left( {N - 2} \right)\left( {N - 3} \right)}}{\kern 1pt} {\kern 1pt} {\kern 1pt} \frac{{\left( {N + 1} \right){\kern 1pt} {\kern 1pt} {m_4} - 3{\kern 1pt} {\kern 1pt} \left( {N - 1} \right){\kern 1pt} {\kern 1pt} m_2^2}}{{{s^4}}}\)

Ku=0 statistic

\(z = Ku\sqrt {\frac{{\left( {N - 1} \right)\left( {N - 2} \right)\left( {N - 3} \right)}}{{24{\kern 1pt} {\kern 1pt} {\kern 1pt} N{\kern 1pt} {\kern 1pt} \left( {N + 1} \right)}}} \)

Jarque-Bera

\(jb = N\left( {\frac{{{{(Ku)}^2}}}{{24}} + \frac{{{{(Sk)}^2}}}{6}} \right)\)

Jarque-Bera test

\(jb{\rm{ as a }}\chi _2^2\)


 

For accuracy, the calculations are all done as written here, and are not done using (theoretically) equivalent expressions with uncentered moments.

 

Estimates of the variance can also be obtained from many other instructions, such as CORRELATE, VCV, CMOMENT. Those estimates will be different from those produced by STATISTICS as only STATISTICS uses an \(N-1\) divisor. The estimates from VCV and CMOMENT might show an even greater difference because those use a set of entries common to all series involved, which may not be the same as the range which would be used for each separately.

 

The formulas for skewness and kurtosis include small-sample corrections which are omitted by many other software packages. As a result, values for these (and the Jarque-Bera statistic derived from them) will often be somewhat different from those obtained using other software.

 


Copyright © 2026 Thomas A. Doan