Tables of Means, Medians and Other Summary Statistics by using Stata

Summary Statistics tabulate produces tables of means and standard deviations within categories of the tabulated variable. For the remaining examples in this chapter, we return to the data on electricity consumption in U.S. states. tabulate gives us one way to view summary statistics of per capita electricity consumption (elcap) for each of the 9 U.S. census divisions (region9): . tabulate region9, summ(elcap)

We could also use tabulate to form a two-way table of means, as in this contrived example using the 9 census divisions and 4 census regions: . tabulate region9 region4, summ(elcap) mean

The means option above called for a table containing only means. Otherwise we get a bulkier table with means, standard deviations and frequencies within each cell.

The more flexible table command can build up to seven-way tables containing means, standard deviations, sums, medians or other statistics. For illustration, here is a one-way table showing mean and standard deviation of per capita electricity use and also the median and interquartile range of population, within each census division.

. table region9, contents (mean elcap sd elcap median pop iqr pop)

Mean per capita electricity use varies by a factor of two, from the low of 8,417 kWh in New England to a high of 17,948 kWh in the West South Central division (which includes the oil- producing states of Texas, Louisiana and Oklahoma). The greatest variation, on the other hand, occurs among the Mountain states, where the standard deviation (5,723 kWh) is ten times that of New England (533 kWh).

The contents) ) option with table specifies what statistics, for what variables, each cell should contain. The possible statistics also include minimum, maximum, sum, percentiles and several types of standard error. See help table for the list.

Source: Hamilton Lawrence C. (2012), Statistics with STATA: Version 12, Cengage Learning; 8th edition.

Leave a Reply

Your email address will not be published. Required fields are marked *