# Re: st: Calculating the Medians among group categories

 From "Austin Nichols" <[email protected]> To [email protected] Subject Re: st: Calculating the Medians among group categories Date Tue, 30 Jan 2007 11:39:33 -0500

```Marcella--
Alan rightly points out that this is a question for an intro stats
book, and easily addressed (insofar as it is possible to address) with
a calculator or paper and pencil.  But I would tackle it in Stata, in
this way:

input str18 v1 v2 v3
"2-bedrooms:    " .    15223372
"with cash rent:" .    14449016
"< \$200         " 200  335924
"\$200 to \$299   " 299  385018
"\$300 to \$499   " 499  1849604
"\$500 to \$749   " 749  4898457
"\$750 to \$999   " 999  3803812
"> \$1000        " 1000 3176201
"no cash rent   " 0    774356
end
sort v2
g rs=sum(v3) if v2<.
g fr=v3/rs[7] if v2<.
g cf=rs/rs[7] if v2<.
l v1 v3 fr cf if v2<., noo sep(8)

which tells you (via the cumulative freq var) that 54% have rent below
\$750, so the median is close to \$750 but somewhat below that value.

On 1/29/07, Alan Neustadtl <[email protected]> wrote:
```
```You are trying to estimate the 50th percentile from grouped data.
Many introductory statistics text book cover this kind of problem.  In
the social sciences you can see "Social Statistics" by Blalock or
"Statistics for Social Data Analysis" by David Knoke et al. for
examples.  It is easy to do with a hand calculator.

Best,
Alan

On 1/29/07, Marcella Sapun <[email protected]> wrote:
> Dear Stata Users:
>
> I need to get the median rents for a group of renters living in
> 2-bedroom occupied housing units. I don't have the actual raw data set
> to derive the medians. But I have a table with the following information
> on the following Renter-Occupied categories:
>
> Categories:                            Estimate total#
> -------------------------------------------------------------------------
> 2-bedrooms:                          15,223,372
> with cash rent:                      14,449,016
> < \$200                                   335,924
> \$200 to \$299                         385,018
> \$300 to \$499                         1,849,604
> \$500 to \$749                         4,898,457
> \$750 to \$999                         3,803,812
> > \$1000                                3,176,201
> no cash rent                          774,356
> --------------------------------------------------------------------------
>
> Does someone have any ideas to compute the median rent (i.e cash rent
> and no cash rent) among all the groups. Can I do this in STATA?
```
```*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```