Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Sample with weights

From   Nick Winter <>
Subject   Re: st: Sample with weights
Date   Fri, 30 Sep 2005 14:43:36 -0400

At 02:00 PM 9/30/2005, you wrote:
Willard wrote:
I have a population of company's. I want a sample from this population,
but the probability of a company to be sampled has to be equivalent with
the number of employees (let's call this "size").

I would take an approach like this:

(1) Calculate for each company the probability of inclusion. This is (sample size) * (size of company / total of company sizes). So assuming a sample size of 100:

. sum size
. gen prob = 100 * ( size / r(sum) )

(2) Then select the sample based on these probabilities

. gen u = uniform()

. gen insamp = u < prob

The problem is that this approach generates an *average* sample size of 100, but not exactly 100 in every case. Thoughts?

Nick Winter

Nicholas J. G. Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government e
Cornell University w
308 White Hall
Ithaca, NY 14853-4601

* For searches and help try:

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