------------------------------------------------------------------------------- help formoments-------------------------------------------------------------------------------

Moment-based statistics

moments[varlist] [ifexp] [inrange] [weight] [,allobsformat(numeric_format(s))matname(matrix_name)tabdisp_optionsvariablenames]

momentsvarname[ifexp] [inrange] [weight] [,allobsby(varlist)format(numeric_format(s))matname(matrix_name)tabdisp_options]

by ... :may be used withmoments: see help on by.

aweights andfweights are allowed; see help weights.

Description

momentscalculates mean, standard deviation, skewness and kurtosis forvarlist. Any string variables invarlistare ignored.

Options

allobsspecifies use of the maximum possible number of observations for each variable. The default is to use only those observations for which all variables invarlistare not missing.

by()specifies one or more variables defining distinct groups for which moment-based statistics should be calculated.by()is allowed only with a singlevarname. The choice betweenby:andby()is one of precisely what kind of output display is required. The display withby:is clearly structured by groups while that withby()is more compact. To show moments for several variables and several groups with a single call tomoments, the display withby:is essential.

format()controls the display format of mean, standard deviation, skewness and kurtosis, as follows. Up to four numeric formats may be given. The first numeric format given controls the display of the mean; any second numeric format that of the standard deviation; any third numeric format that of the skewness, and any fourth numeric format that of the kurtosis. Formats not specified default to%9.3f.

matname()specifies the name of a matrix in which to save the results of (the last set of) calculations. There will be 5 columns. The columns will contain n, mean, standard deviation, skewness and kurtosis.

tabdisp_optionsare options of tabdisp other thanformat().

variablenamesspecifies that the variable names ofvarlistshould be used in display. The default is to use variable labels to indicate a set of variables.

Examples

. moments

. moments price-foreign. moments price-foreign, format(%5.1f %5.1f)

. bysort rep78: moments mpg

AuthorNicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk

Also seehelp for summarize, help for tabstat