Trying to Simulate Selection Rules Diffiicult

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

Trying to Simulate Selection Rules Diffiicult

Zachary Feinstein
The scenario is I have 1,000 respondents in a survey.  Each person is classified as having a score between 1 and 7 for some brands they rated.  They could have rated up to 15 brands total.
 
My job is to randomly select 4 brands that they will do followup ratings with.  Problems occur because some of the rules overlap and I think I know how to fix it but I do not know the SPSS code.
 
So it starts out by saying brand1 is chosen based on who had the highest score.  Only one can fit into Brand 1.
 
Then the algorithm starts looking at filling brand2 then brand3.  Brand 2 says to pull a certain brand but if that does not occur then use another rule.  That same rule defines the first condition for brand 3.
 
So, for example, the first rule for 2 might say to pull any brand that is a 5 or 6, but if they do not exist then pull a 3 or 4 and submit that instead to brand 2.
 
But brand 3 is to first try to pull 3 or 4 but the problem is that I want to remove any responses (not cases) selected from brand 2 from the pool before I get to brand 3.
 
To visualize this I am also submitting one respondent from a stacked dataset below.  They are no. 1291.  I broke brand2 into 2 different fields.  One is called brand2_1 and the next one is called brand2_2.  No-one qualified to rate the brands based on the first Brand 2 definition but many did based on the 2nd one.  What I need to learn to program is if I pull the first response off of brand2_2 then I want to remove that same first response from brand3_1.  I am using AGGREGATE with the FIRST() functionality to pull the first instance I find for each of the listed fields.  So ideally the first for each.  If I can get the program to work it would be 3-1-5-2.  The 5 is pulled because I somehow got rid of the first 1 there because it was selected for Brand2.
 
Any and all help is highly valued and appreciated.
 
Zachary
(651) 698-2184
 
RESPID brand brand1 brand2_1 brand2_2 brand3_1 brand3_2 brand4
1291 . 3 . . . . .
1291 1 . . 1 1 . .
1291 5 . . 5 5 . .
1291 7 . . 7 7 . .
1291 10 . . 10 10 . .
1291 12 . . 12 12 . .
1291 13 . . 13 13 . .
1291 14 . . 14 14 . .
1291 6 . . . . 6 .
1291 8 . . . . 8 .
1291 2 . . . . . 2
1291 4 . . . . . 4
1291 9 . . . . 9 .
1291 11 . . . . . .
1291 15 . . . . . .

Reply | Threaded
Open this post in threaded view
|

Re: Trying to Simulate Selection Rules Diffiicult

ViAnn Beadle

This sounds a bit like TURF analysis? If so, I think that there is a python-based module to do it on the SPSS DevCentral site.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Zachary Feinstein
Sent: Wednesday, June 17, 2009 1:21 PM
To: [hidden email]
Subject: Trying to Simulate Selection Rules Diffiicult

 

The scenario is I have 1,000 respondents in a survey.  Each person is classified as having a score between 1 and 7 for some brands they rated.  They could have rated up to 15 brands total.

 

My job is to randomly select 4 brands that they will do followup ratings with.  Problems occur because some of the rules overlap and I think I know how to fix it but I do not know the SPSS code.

 

So it starts out by saying brand1 is chosen based on who had the highest score.  Only one can fit into Brand 1.

 

Then the algorithm starts looking at filling brand2 then brand3.  Brand 2 says to pull a certain brand but if that does not occur then use another rule.  That same rule defines the first condition for brand 3.

 

So, for example, the first rule for 2 might say to pull any brand that is a 5 or 6, but if they do not exist then pull a 3 or 4 and submit that instead to brand 2.

 

But brand 3 is to first try to pull 3 or 4 but the problem is that I want to remove any responses (not cases) selected from brand 2 from the pool before I get to brand 3.

 

To visualize this I am also submitting one respondent from a stacked dataset below.  They are no. 1291.  I broke brand2 into 2 different fields.  One is called brand2_1 and the next one is called brand2_2.  No-one qualified to rate the brands based on the first Brand 2 definition but many did based on the 2nd one.  What I need to learn to program is if I pull the first response off of brand2_2 then I want to remove that same first response from brand3_1.  I am using AGGREGATE with the FIRST() functionality to pull the first instance I find for each of the listed fields.  So ideally the first for each.  If I can get the program to work it would be 3-1-5-2.  The 5 is pulled because I somehow got rid of the first 1 there because it was selected for Brand2.

 

Any and all help is highly valued and appreciated.

 

Zachary

(651) 698-2184

 

RESPID

brand

brand1

brand2_1

brand2_2

brand3_1

brand3_2

brand4

1291

.

3

.

.

.

.

.

1291

1

.

.

1

1

.

.

1291

5

.

.

5

5

.

.

1291

7

.

.

7

7

.

.

1291

10

.

.

10

10

.

.

1291

12

.

.

12

12

.

.

1291

13

.

.

13

13

.

.

1291

14

.

.

14

14

.

.

1291

6

.

.

.

.

6

.

1291

8

.

.

.

.

8

.

1291

2

.

.

.

.

.

2

1291

4

.

.

.

.

.

4

1291

9

.

.

.

.

9

.

1291

11

.

.

.

.

.

.

1291

15

.

.

.

.

.

.