aleatory assignment of quotas

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

aleatory assignment of quotas

Sebastián Daza
dear,
I write them because I need to assign quotas (sex and age) for a sample in an aleatory way. The format of the database in spss is the following one:

county cluster (zip area) cases for zip area man 18-34 man 35-54 man 55 or more women 18-34 women 35-54 women 55 o more
1 1 5
         
1 2 5
         
1 3 5
         
1 4 5
         
1 5 5
         
1 6 5
         

In each cluster, I need to assign as maximum five interviewed, according to the distribution of the quotas.

Man 18-34 7
Man 35-54 2
Man 55 or more 3
Women 18-34 8
Women 35-54 4
Women 55 o more
6

What I need is that the distribution of the quotas is aleatory, the only condition is that the total of each column (ex. man 18-34) is same to the number of quota (ex. 7) and the each row is same to 5 (total of having interviewed by zip area). An example would be:

county cluster (zip area) cases for zip area man 18-34 man 35-54 man 55 or more women 18-34 women 35-54 women 55 or more
1 1 5 1  0  0  1  2
1 2 5 0
 1  0 ...
...
...
1 3 5 2
 0
   
1 4 5 1
 0  1
   
1 5 5 3
 1  1
   
1 6 5 0
 0  0
   

Does somebody know how it could assign aleatory quotas in spss?  some suggestion of how to distribute the quotas? Thank you for the help.


--
Sebastián Daza Aranzaes

Sebastián Daza Aranzaes
Instituto de Sociología UC
8-471 53 87 / 686 57 20 / Fax 5521834
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: aleatory assignment of quotas

Sebastián Daza
Hello Gene and List:
exactly, it looks as if you have six age-sex combinations and that a total of five people are specified to be sampled across those six combinations. I then want to make draws from a uniform randon distribution for the number of people from each age-sex combination to be interviewed such that the number of persons to be interviewed sums to five. But I don't know how to make it in spss, because I have 240 clusters, and the total sample is of 1200 cases.
 
thank you for everything.


Original mail:

I write them because I need to assign quotas (sex and age) for a sample in an aleatory way. The format of the database in spss is the following one:

county cluster (zip area) cases for zip area man 18-34 man 35-54 man 55 or more women 18-34 women 35-54 women 55 o more
1 1 5
         
1 2 5
         
1 3 5
         
1 4 5
         
1 5 5
         
1 6 5
         

In each cluster, I need to assign as maximum five interviewed, according to the distribution of the quotas.

Man 18-34 7
Man 35-54 2
Man 55 or more 3
Women 18-34 8
Women 35-54 4
Women 55 o more
6

What I need is that the distribution of the quotas is aleatory, the only condition is that the total of each column (ex. man 18-34) is same to the number of quota (ex. 7) and the each row is same to 5 (total of having interviewed by zip area). An example would be:

county cluster (zip area) cases for zip area man 18-34 man 35-54 man 55 or more women 18-34 women 35-54 women 55 or more
1 1 5 1  0  0  1  2
1 2 5 0
 1  0 ...
...
...
1 3 5 2
 0
   
1 4 5 1
 0  1
   
1 5 5 3
 1  1
   
1 6 5 0
 0  0
   

Does somebody know how it could assign aleatory quotas in spss?  some suggestion of how to distribute the quotas? Thank you for the help.
Message


--
Sebastián Daza Aranzaes

Sebastián Daza Aranzaes
Instituto de Sociología UC
8-471 53 87 / 686 57 20 / Fax 5521834
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: aleatory assignment of quotas

Sebastián Daza
In reply to this post by Sebastián Daza
Hello Gene and List:
exactly, it looks as if you have six age-sex combinations and that a total of five people are specified to be sampled across those six combinations. I then want to make draws from a uniform randon distribution for the number of people from each age-sex combination to be interviewed such that the number of persons to be interviewed sums to five. But I don't know how to make it in spss, because I have 240 clusters, and the total sample is of 1200 cases.
 
thank you for everything.


Original mail:

I write them because I need to assign quotas (sex and age) for a sample in an aleatory way. The format of the database in spss is the following one:

county cluster (zip area) cases for zip area man 18-34 man 35-54 man 55 or more women 18-34 women 35-54 women 55 o more
1 1 5
         
1 2 5
         
1 3 5
         
1 4 5
         
1 5 5
         
1 6 5
         

In each cluster, I need to assign as maximum five interviewed, according to the distribution of the quotas.

Man 18-34 7
Man 35-54 2
Man 55 or more 3
Women 18-34 8
Women 35-54 4
Women 55 o more
6

What I need is that the distribution of the quotas is aleatory, the only condition is that the total of each column (ex. man 18-34) is same to the number of quota (ex. 7) and the each row is same to 5 (total of having interviewed by zip area). An example would be:

county cluster (zip area) cases for zip area man 18-34 man 35-54 man 55 or more women 18-34 women 35-54 women 55 or more
1 1 5 1  0  0  1  2
1 2 5 0
 1  0 ...
...
...
1 3 5 2
 0
   
1 4 5 1
 0  1
   
1 5 5 3
 1  1
   
1 6 5 0
 0  0
   

Does somebody know how it could assign aleatory quotas in spss?  some suggestion of how to distribute the quotas? Thank you for the help.
Message


--
Sebastián Daza Aranzaes

Sebastián Daza Aranzaes
Instituto de Sociología UC
8-471 53 87 / 686 57 20 / Fax 5521834
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: aleatory assignment of quotas

Maguin, Eugene
In reply to this post by Sebastián Daza
Sebastian,

Here's my idea. I hope i've understood your problem correctly, and i'm not
sure that i have.

Let your six sex-age combination variables be called m18 m35 m55 f18 f35
f55.

The goal is to specifiy the number of persons to be sampled in each of the
six sex-age variables such that the sum of persons equals 5 for each record
in your dataset, that is each combination of county and cluster.

My scheme is to draw a random number between 1 and 6 to specify the starting
age-sex variable and then draw a random numbers between 0 and 5 to specify
the number of persons to select for that age-sex combination. Advance to the
next age-sex combination. Draw another number between 0 and 5. However, if
that number plus the sum of the previously drawn numbers is greater than 5,
throw it away and draw another. Repeat until the sum is less or equal to 5.
Once the sum equals 5, the remaining age-sex combinations are set to 0.

The following syntax works correctly on my computer and looks to be correct,
but check the results carefully that you are really getting what you want.

Gene Maguin


*  THIS GENERATES 6 CASES WITH THE INDICATED VALUES FOR COUNTY CLUSTER
CASES.
INPUT PROGRAM.
LOOP #I=1 TO 6.
+  COMPUTE COUNTY=1.
+  COMPUTE CLUSTER=#I.
+  COMPUTE CASES=5.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXECUTE.

NUMERIC M18 M35 M55 F18 F35 F55.


*  THIS IS THE REAL PART OF THE PROJECT.
Vector agesex=m18 to f55.
Compute sv=trunc(uniform(5)). /* STARTING VALUE OF AGESEX VECTOR.
Compute total=0.
Loop #i=1 to 6.
+  Compute #k=mod((sv+#i),6).
+  if (#k eq 0) #k=6.
+  do if (total lt 5).
+     loop #j=1 to 100.
+        Compute draw=trunc(uniform(6)). /* CASES TO DRAW.
+        do if ((total+draw) le 5).
+           compute total=total+draw.
+           compute agesex(#k)=draw.
+           break.
+        end if.
+     end loop.
+  else.
+     compute agesex(#k)=0.
+  end if.
End loop.
EXECUTE.

FORMAT COUNTY CLUSTER CASES M18 M35 M55 F18 F35 F55 SV J(F2.0).

LIST COUNTY CLUSTER CASES M18 M35 M55 F18 F35 F55 SV J.
Reply | Threaded
Open this post in threaded view
|

replace value with varname

parisec
In reply to this post by Sebastián Daza
I've got what i think is a simple question but i don't know if a command exists to do this.

I need to create a mail merge file out of a file that looks like this:.

ID      var1    var2    var3
1       5       2       4
2       6       0       0
3       0       0       0

I want to compute a variable that says:

        If (var1 ne $sysmis) var1 = "variable1 name"
        If (var1 = $sysmis) var1 = $sysmis.
                *repeat for var1 and var3

(without having to actually spell out var1) and leave a blank where this is not true.

...so that my file would look like this:

ID      var1    var2    var3

1       var1    var2    var3
2       var1
3

however,  i don't know of a command that says "use the variable name"

any ideas?

Thanks
Carol
Reply | Threaded
Open this post in threaded view
|

Re: replace value with varname

Dennis Deck
Consider using:
 a) VALUE LABELS to assign the desired labels you want for each value
 b) SUMMARIZE to display list using these value labels in tabular
format:

SUMMARIZE
  ID var1 var2 var3
  /Format= list nototal nocasenum  /Cells= none .

Paste resulting table into Word and do your mailmerge.

Dennis Deck, PhD
RMC Research Corporation
[hidden email]

-----Original Message-----
From: Parise, Carol A. [mailto:[hidden email]]
Sent: Tuesday, January 30, 2007 4:42 PM
Subject: replace value with varname

I've got what i think is a simple question but i don't know if a command
exists to do this.

I need to create a mail merge file out of a file that looks like this:.

ID      var1    var2    var3
1       5       2       4
2       6       0       0
3       0       0       0

I want to compute a variable that says:

        If (var1 ne $sysmis) var1 = "variable1 name"
        If (var1 = $sysmis) var1 = $sysmis.
                *repeat for var1 and var3

(without having to actually spell out var1) and leave a blank where this
is not true.

...so that my file would look like this:

ID      var1    var2    var3

1       var1    var2    var3
2       var1
3

however,  i don't know of a command that says "use the variable name"

any ideas?

Thanks
Carol