random sample?

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

random sample?

Paola Chivers-2

Hi,

 

I want to be able to select two random samples from an original sample.  Simply I believe I use the following

 

Data

Select cases

 – random sample of cases

-          Sample size.

 

However ... gender (Male female) and group (1, 2, 3) need to be represented equally in both random samples.  Is there a way of specifying this?

 

If not, is it valid to split my data into the 6 individual group datasets, then run the random samples, and then put each random  group back together with my 6 subgroups (gender, group)?

 

 

Regards,

Paola

 

“Ours has become a time-poor society, fatigued by non-physical demands and trying to compartmentalize daily living tasks.  It is small wonder that physical activity is discarded in this environment” p126 (Steinbeck, 2001)

 

P Please consider the environment before printing this email.

 

 

Reply | Threaded
Open this post in threaded view
|

Re: random sample?

Albert-Jan Roskam
Hi!

You could place the SAMPLE command in a DO IF structure,

DO IF group eq 1 AND gender eq 1.
+SAMPLE 1000 FROM 1200.
ELSE IF group eq 1 AND gender eq 2.
....
....

etc.

Not a very scalable solution, but it should work. Another approach would be to create a weight for the desired proportions, apply that and draw a sample.

Albert-Jan

--- On Tue, 6/9/09, Paola Chivers <[hidden email]> wrote:

> From: Paola Chivers <[hidden email]>
> Subject: random sample?
> To: [hidden email]
> Date: Tuesday, June 9, 2009, 4:18 AM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Hi,
>
>  �
>
> I want to be able to select two random
> samples from an
> original sample.�  Simply I believe I use the
> following
>
>  �
>
> Data
>
> Select
> cases
>
> � – random sample of
> cases
>
> -� � � � � � � � �
> Sample size.
>
>  �
>
> However ... gender (Male female) and
> group (1, 2, 3) need to
> be represented equally in both random samples.�  Is
> there a way of specifying
> this?
>
>  �
>
> If not, is it valid to split my data
> into the 6 individual group
> datasets, then run the random samples, and then put each
> random � group back
> together with my 6 subgroups (gender, group)?
>
>  �
>
>  �
>
> Regards,
>
>
> Paola
>
>
> �
>
> “Ours has become a
> time-poor society, fatigued by
> non-physical demands and trying to compartmentalize daily
> living tasks.�
> It is small wonder that physical activity is discarded in
> this
> environment” p126 (Steinbeck,
> 2001)
>
>
> �
>
> P Please consider the
> environment before printing� this
> email.
>
>
> �
>
>  �
>
>
>
>
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: random sample?

Paola Chivers-2
Thanks Albert - you steered me in the right direction.

I've been playing around with syntax with not much luck (but that is my lack of experience on the syntax side).  I also tried the syntax below and then ran descriptives to see how my split looked.  The six subgroups were actually pretty evenly represented.  I also went back to my original split sample (just the random split function) and that also was pretty evenly split for the six groups.

I don't understand how this happened ... but am happy that the outcome was achieved.  This of course might make much more sense to those of you experienced with the underlying maths / syntax of these functions.

SORT CASES  BY SEX group3.
SPLIT FILE SEPARATE BY SEX group3.

USE ALL.
COMPUTE filter2_$=(uniform(1)<=.50).
VARIABLE LABEL filter2_$ 'Approximately 50% of the cases (SAMPLE)'.
FORMAT filter2_$ (f1.0).
FILTER  BY filter2_$.
EXECUTE.

Regards,
Paola

“Ours has become a time-poor society, fatigued by non-physical demands and trying to compartmentalize daily living tasks.  It is small wonder that physical activity is discarded in this environment” p126 (Steinbeck, 2001)

 Please consider the environment before printing this email.


-----Original Message-----
From: Albert-jan Roskam [mailto:[hidden email]]
Sent: Tuesday, 9 June 2009 8:16 PM
To: [hidden email]; Paola Chivers
Subject: Re: random sample?


Hi!

You could place the SAMPLE command in a DO IF structure,

DO IF group eq 1 AND gender eq 1.
+SAMPLE 1000 FROM 1200.
ELSE IF group eq 1 AND gender eq 2.
....
....

etc.

Not a very scalable solution, but it should work. Another approach would be to create a weight for the desired proportions, apply that and draw a sample.

Albert-Jan

--- On Tue, 6/9/09, Paola Chivers <[hidden email]> wrote:

> From: Paola Chivers <[hidden email]>
> Subject: random sample?
> To: [hidden email]
> Date: Tuesday, June 9, 2009, 4:18 AM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Hi,
>
>
>
> I want to be able to select two random
> samples from an
> original sample.  Simply I believe I use the
> following
>
>
>
> Data
>
> Select
> cases
>
>  – random sample of
> cases
>
> -
> Sample size.
>
>
>
> However ... gender (Male female) and
> group (1, 2, 3) need to
> be represented equally in both random samples.  Is
> there a way of specifying
> this?
>
>
>
> If not, is it valid to split my data
> into the 6 individual group
> datasets, then run the random samples, and then put each
> random  group back
> together with my 6 subgroups (gender, group)?
>
>
>
>
>
> Regards,
>
>
> Paola
>
>
>
>
> “Ours has become a
> time-poor society, fatigued by
> non-physical demands and trying to compartmentalize daily
> living tasks.
> It is small wonder that physical activity is discarded in
> this
> environment” p126 (Steinbeck,
> 2001)
>
>
>
>
> P Please consider the
> environment before printing this
> email.
>
>
>
>
>
>
>
>
>
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD