Stratified Sampling?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Stratified Sampling?

Roger Molina
Dear SPSS listers:

I have a database with 8000 cases, I like to get a sample using a variable
of selection (Name) , I need at least 5 registries by each value or strata
of var. Name. I don’t need that all strata of var. Name are selected, but
that those selected has at least 5 registries until completing 947
observations.

Name, Counts
Strata1,11
Strata1,11
Strata1,11
Strata1,11
Strata1,11
Strata1,11
Strata1,11
Strata2,9
Strata2,9
Strata2,9
Strata2,9
Strata2,9
Strata2,9
Strata2,9
Strata3,10
Strata3,10
Strata3,10
......

I would believe that this is a sampling stratified but the sample don´t take
all values or strata of var. Name

What I have to do so that I get this sample?

Regards

Roger
Reply | Threaded
Open this post in threaded view
|

Re: Stratified Sampling?

hillel vardi
Shalom

Here is a syntax to do the job .
You have to remember that you will only get 5 cases from a strata if
there are 5 cases in it , in you example there is only 3 cases in strata
10 .
Also the variable orig_order is only to show that the new order is random .

Hillel Vardi

Data List list / Name Counts( a7 f3 ) .
Begin Data
Strata1 11
Strata1 11
Strata1 11
Strata1 11
Strata1 11
Strata1 11
Strata1 11
Strata2 9
Strata2 9
Strata2 9
Strata2 9
Strata2 9
Strata2 9
Strata2 9
Strata3 10
Strata3 10
Strata3 10
end data .

compute orig_order=$casenum.
COMPUTE randum=UNIFORM(10).
sort cases by name randum .
add files file=* / by name / first=first .
numeric seq(f6) .
leave seq .
if first seq= 0.
compute seq =sum(seq,1) .
select if seq le 5 .
EXECUTE .




Roger Molina wrote:

> Dear SPSS listers:
>
> I have a database with 8000 cases, I like to get a sample using a variable
> of selection (Name) , I need at least 5 registries by each value or strata
> of var. Name. I don’t need that all strata of var. Name are selected, but
> that those selected has at least 5 registries until completing 947
> observations.
>
> Name, Counts
> Strata1,11
> Strata1,11
> Strata1,11
> Strata1,11
> Strata1,11
> Strata1,11
> Strata1,11
> Strata2,9
> Strata2,9
> Strata2,9
> Strata2,9
> Strata2,9
> Strata2,9
> Strata2,9
> Strata3,10
> Strata3,10
> Strata3,10
> ......
>
> I would believe that this is a sampling stratified but the sample don´t take
> all values or strata of var. Name
>
> What I have to do so that I get this sample?
>
> Regards
>
> Roger
>
>