[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: identifying comparison groups with similar distributions along one metric

From   Jeph Herrin <>
Subject   Re: st: identifying comparison groups with similar distributions along one metric
Date   Tue, 20 Oct 2009 12:07:25 -0400

How about sort on cost, and then for each 4
values, assign randomly into groups? Eg,

 sort cost
 gen strata = mod(_n,4)
 gen random = uniform()
 bys strata (random) : gen byte group=_n

where I've been generous with code for clarity.


Kate Rohrbaugh wrote:
This is my first posting to Statalist, so I ask for forgiveness in
any breaks in protocol.

I have a dataset of about 300 observations and I am going to separate
them into 4 groups -- not totally equal in size but based on certain
characteristics.  I want the four groups to all have similar
distributions along a certain metric (i.e., cost) -- so the mean,
median, SD, etc., are similar, so I want to sample observations from
each group.  I'll choose one of the four groups as my baseline
(probably the one with smallest range or the fewest number of
observations - but I'm open to any suggestions about that as well).

What's the best approach for doing this?  I suspect this question has
been addressed numerous times in various places, so being pointed in
the right direction is sufficient.  Note: we still have Stata 9.2, so
nothing too fancy.

Thank you!


<HTML><HEAD> <META http-equiv=Content-Type content="text/html;
charset=iso-8859-15"> <META content="MSHTML 6.00.5730.11"
name=GENERATOR></HEAD> <BODY style="MARGIN: 4px 4px 1px; FONT: 12pt
Comic Sans MS; COLOR: #000000"> <DIV>&nbsp;</DIV> <DIV>&nbsp;</DIV> <DIV> <HR> </DIV> <DIV><FONT face=Arial size=1>This email message and
any attached files are confidential and are intended solely for the
use of the addressee(s) named above. This communication may contain
material protected by legal privileges. If you are not the intended
recipient or person responsible for delivering this confidential
communication to the intended recipient, you have received this
communication in error; any review, use, dissemination, forwarding,
printing, copying or other distribution of this email message and any
attached files is strictly prohibited. Independent Project Analysis
Inc. reserves the right to monitor any communication that is created,
received, or sent on its network. If you have received this
confidential communication in error, please notify the sender
immediately by reply email message and permanently delete the
original message. Thank you for your

* *   For searches and help try: * * *

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index