Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create a subsample - Conditional, weighted random draw of observations, with repalcement

    Dear Statalisters

    I want to create a random subsample of my original sample; I am basically drawing geographical area to which I will apply a treatment.
    So, I have a few questions on random drawing:
    1. Is there are a way to randomly draw observations from a larger dataset, to create a subsample?
    2. If the answer to 1. is "yes", is it possible to carry out a conditional drawing, that is, observations with certain characteristics cannot be drawn? I guess that the simplest thing here is just to drop unwanted observations from the original sample.
    3. What about weighted drawing, that is, observations with certain characteristics are more or less likely to be drawn?
    4. What about drawing with and without replacement (some of the areas to which I will apply a treatment have a larger population, so I might be applying the tratment to them multiple times)?
    I have been browsing through statalist material (e.g. online manuals) and Stata posts on statalist, but I cannot find what I am looking for.
    It is the first time I try to create a subsample this way with Stata.
    Last edited by FLuca; 03 Feb 2020, 11:16.

  • #2
    Yes.

    You can draw random (sub)samples without replacement (help sample) as well as with replacement (help bsample, and here you can add weights).

    Both commands allow for "if" condition.

    You can also take a look at this FAQ.

    Hopefully that helps.
    Best regards,

    Marcos

    Comment

    Working...
    X