deconstructing silence:
the queer political economy of the social articulation of desire

Appendix


Below is the command file used to generate the 6x3x2 simulation results reported here. It was written in BBEdit Lite 3.0 for the Shazam 7.0 econometrics package adapted to the PowerMac and used on a PowerMac 6100 with 16 MB of RAM and a 9500 with 32 MB of RAM. Redundant parts have been eliminated from this so that it does not take forever to download. The original was 500K long. Instructions are given here to reconstruct it.

SIZE 15000
SET NOECHO
SET NODOECHO
SET NOWARN
SET NOWARNSKIP

GEN1 n1 = 6
GEN1 n2 = 3
gen1 NNBR = 2
GEN1 n = n1 + n2
GEN1 nplus1 = n + 1
GEN1 n12 = n1 + 1
GEN1 n12plus = n12 + 1
gen1 naug = n + 3
gen1 nsamp = n - 1

* need nsamp > 3 for Do-Loop chosing neighbors at start of Numitests
*n1 = number of people of TYPE 1: optimal choice at X = 16 (alpha=.66667)
*n2 = number of people of TYPE 2: optimal choice at X = 20 (alpha=.83333)
*must have n > 6 : Require at least n = 5 for construction of Ynbr!
*NNBR = Number of Neighbors with whom each person compares own rankings
*naug is used for printing out X. It equals n + (no. of types) + 1

GEN1 rho = 0.5
*For Type1 utility fns, prob of Type 1 error was .021 averaged over 10 iterations each looking at all 300 rankings
*For Type2 utility fns, prob of Type 1 error was .01

GEN1 rhosame = .1
*rhosame is fraction by which reduce P!a:? if t-test indicated ? not at all the same as !
*When Face!Face?: P!a:? decreases to 0 as P!LTS and rhosame get close to zero
*When Face!=Face?: P!a:? increases IFF if P!LTS < .5
*this addresses issue that usually t-Face was very sign. and so anyone with diff. Label
*was usually eliminated from !'s neighbors in only one iteration.

GEN1 pausit = 8
GEN1 numitest = 3
GEN1 lastit = 2*pausit + 1 + 40*numitest

* numitest = NUMber of ITerations in one cycle doing TESTs with Probit
* split these Probit cycles up so can do COMPRESS in between: save > 10 MEG with each COMPRESS
* It stops before lastit if get MaxNZPr = [no. of Prob$'s > .001 ] < 1
GEN1 crediff = .5
GEN1 UNIFE = 0.0079544
*UNIFE = std dev in normally dist'd error in measuring utility
GEN1 POWERE = .5
*POWERE = power to which ((1/#)**(.5)) is raised and multiplied times UNIFE
*where # is number of iteration. This makes learning very slow.
*NO RANDOMNESS IN PRICES

gen1 P0 = 1
GEN1 UNIFP = 0
GEN1 NCHOI = 25
gen1 pro1 = 1/nchoi

Do ! = 1,n
dim person! NNBR
endo

Do ! = 1,n
Dim Ps!U 25
Dim Ps!PR 25
endo

Do $ = 2,25
gen1 end = $-1
Do % = 1,end
dim Y$o% n
endo
endo

Do ! = 1,n
Dim P!a n
Dim Q!a n
endo

sample 1 1
gen1 IT = 1
gen1 MaxNZPr = 25

gen1 ononone = 111
sample 1 n1
GENR Coun1 = 25
matrix count = (ononone|coun1')'
gen1 twtwtwo = 222
sample 1 n2
GENR Coun2 = 25
matrix count = (count'|twtwtwo|coun2')'
*This is starting value for Count which = vector of no. of Ps!Pr$'s Greater Than 0.001

gen1 onone = 11
sample 1 n1
genr name = time(0)
matrix CountMat = (onone|name')'
matrix X = (onone|name')'
gen1 twtwo = 22
delete name
sample 1 n2
genr name = time(n1)
matrix CountMat = (CountMat'|twtwo|name')'
matrix X = (X'|twtwo|name')'
gen1 lalab = 0
matrix CountMat = (CountMat'|lalab)'
matrix X = (X'|lalab)'
matrix CountMat = CountMat|(((Count)'|IT)')

sample 1 2
genr name1 = 1
matrix NbrMat = name1
do ! = 2,n
genr name! = !
matrix NbrMat = (NbrMat'|name!')'
endo
matrix NbrMat = (NbrMat'|IT)'

* ****************
* ****************
*First create initial prior prob's on whether ! and ? are "same"

sample 1 1
Do ? = 1,n
gen1 LAB? = 1 - DUM(MOD(?+3,4))
endo
*DUM(MOD(?+3,4)) = 1 IFF MOD(?+3,4) > 0 which is true IFF ?+3 is NOT a multiple of 4
*so LAB? = 1 IFF ?+3 IS a multiple of 4
* ?'s Face ends up equalling Lab?


*i?a! = 1 IFF ? and ! have same label. It is indicator for ILLUSORY CORRELATION.
*P?a! = prob according to both ? and ! that they are "ILLUS-SAME"
*prob that they are "DIFF" = 1 - P11?a!
*P?a! = 1-crediff IFF ? and ! have same label and
*P?a! = crediff IFF ? and ! have different label

sample 1 1
Do ! = 1,n
Do ? = 1,n
genr i!a? = 1 - DUM(ABS(LAB? - LAB!))
gen1 P!a:? = (1- (2*crediff))*i!a? + crediff
gen1 Q!a:? = 1- P!a:?
endo
endo
* i!a? = 1 IFF ? and ! have same label

delete name
sample 1 nplus1
genr name = time(0)
Do ! = 1,n
matrix P!SaMat = (name|(P!a'|IT)')
endo

sample 1 nplus1
matrix PrTTest = name
Do ! = 1,n
gen1 P!LTS = .5
endo
matrix NewTTest = P1LTS
Do ! = 2,n
matrix NewTTest = (NewTTest'|(P!LTS))'
endo
matrix NewTTest = (NewTTest'|IT)'
matrix PrTTest = PrTTest|NewTTest

*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
*Now create X-variables to use in Probit
Do $ = 2,25
gen1 end = $ - 1
Do % = 1,end
gen1 X1c$o% = $
gen1 X2c$o% = %
gen1 X3c$o% = $*%
endo
endo

matrix X1seed = X1c2o1
Do $ = 3,25
gen1 end = $ - 1
Do % = 1,end
matrix X1seed = (X1seed'|X1c$o%)'
endo
endo

matrix X2seed = X2c2o1
Do $ = 3,25
gen1 end = $ - 1
Do % = 1,end
matrix X2seed = (X2seed'|X2c$o%)'
endo
endo

matrix X3seed = X3c2o1
Do $ = 3,25
gen1 end = $ - 1
Do % = 1,end
matrix X3seed = (X3seed'|X3c$o%)'
endo
endo

*each X$ variable has (NNBR+1)*300 coord's
*These are used in FACE Probits
matrix X1 = (x1seed)
matrix X2 = (x2seed)
matrix X3 = (x3seed)
Do ? = 1,NNBR
matrix X1 = (x1'|x1seed')'
matrix X2 = (x2'|x2seed')'
matrix X3 = (x3'|x3seed')'
endo

*Next construct X-vectors to use in pairwise comparison Probits:
matrix X1doub = (x1seed'|x1seed')'
matrix X2doub = (x2seed'|x2seed')'
matrix X3doub = (x3seed'|x3seed')'

sample 1 600
genr D = dum(time(0)-300)
*D = 0 for coord's < 300 and D = 1 for coord's > 301
*I tested these commands creating Dx1 ... !!!
*genr DX1 = D*X1doub
*genr DX2 = D*X2doub
*genr DX3 = D*X3doub

Do $ = 2,25
gen1 end = $ - 1
Do % = 1,end
delete X1c$o%
delete X2c$o%
delete X3c$o%
endo
endo

delete X1seed
delete X2seed
delete X3seed

COMPRESS

*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

* Next create starting prob's used to make choices
Do ! = 1,n
Do $ = 1,25
GEN1 Ps!PR:$ = pro1
endo
endo

sample 1 26
genr choice = time(-1)
Do ! = 1,n
matrix P!PrMat = (choice|(Ps!PR'|IT)')
endo

*Make choices of X's
Do ! = 1,n
SAMPLE 1 25
GENR SUM = SUM(Ps!PR)
?STAT SUM / MAXIM=M
SAMPLE 1 1
GEN1 RAN = UNI(M)
sample 1 1
IF(RAN .LT. Sum:1) Ps!X = 0
Do $ = 2,24
gen1 start = $-1
Do % = start,start
gen1 su$ = sum:%
endo
IF(Su$ .LE. RAN .AND. RAN .LT. Sum:$) Ps!X = $-1
endo
IF(Sum:24 .LE. RAN) Ps!X = 24
ENDO
*endo for ! = person

*Construct X matrix of everyone's choice
matrix Xnew = ononone
do ! = 1,n1
matrix Xnew = ((Xnew)'|Ps!X)'
endo
matrix Xnew = ((Xnew)'|twtwtwo)'
do ! = n12,n
matrix Xnew = ((Xnew)'|Ps!X)'
endo
matrix X=X|(Xnew'|IT)'

*specification of utility level gotten by each Type 1 person
sample 1 1
gen1 t = 1
gen1 P = (uni(UNIFP)) + P0
sample 1 1
Do ! = 1,n1
gen1 e = NOR(UNIFE*((t)**POWERE))
Do $ = 1,25
gen1 Ps!U:$ = -9
If(Ps!X .EQ. $ - 1) Ps!U:$ = ((Ps!X/24)**.66667)*&
(((1 - (Ps!X/24))/P)**.33333) + e
ENDO
*endo for $ = choice
ENDO
* endo for ! = person
*specification of utility level gotten by each Type 2 person
sample 1 1
gen1 t = 1
gen1 P = (uni(UNIFP)) + P0
sample 1 1
Do ! = n12,n
gen1 e = NOR(UNIFE*((t)**POWERE))
Do $ = 1,25
gen1 Ps!U:$ = -9
If(Ps!X .EQ. $ - 1) Ps!U:$ = ((Ps!X/24)**.83333)*&
(((1 - (Ps!X/24))/P)**.16667) + e
ENDO
*endo for $ = choice
ENDO
* endo for ! = person

*This is end of iteration #1.
*&&&&&&&&&&&&&&&&&&&&&&&&&&
*&&&&&&&&&&&&&&&&&&&&&&&&&&
*Start iteration #2
Do # = 2,pausit
ENDIF(MaxNZPr .LE. 1)
gen1 IT = IT + 1

Do $ = 2,25
gen1 end = $-1
Do % = 1,end
Do ! = 1,n
IF(Ps!U:% .GT. Ps!U:$ .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 Ps!Pr:$ = rho*Ps!Pr:$
IF(Ps!U:$ .GT. Ps!U:% .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 Ps!PR:% = rho*Ps!Pr:%
endo
*for !
ENDO
ENDO

* Now normalize the Prob's for each person before they choose their X's
Do ? = 1,n
sample 1 25
=?STAT Ps?PR / SUMS = SUMPROB
GENR Ps?PR = (1/sumprob)*Ps?PR
endo
*for ?

Do ! = 1,n
matrix P!PrMat = (P!PrMat|(Ps!PR'|IT)')
endo

*Make choices of X's
Do ! = 1,n
SAMPLE 1 25
GENR SUM = SUM(Ps!PR)
?STAT SUM / MAXIM=M
SAMPLE 1 1
GEN1 RAN = UNI(M)
sample 1 1
IF(RAN .LT. Sum:1) Ps!X = 0
Do $ = 2,24
gen1 start = $-1
Do % = start,start
gen1 su$ = sum:%
endo
IF(Su$ .LE. RAN .AND. RAN .LT. Sum:$) Ps!X = $-1
endo
IF(Sum:24 .LE. RAN) Ps!X = 24
ENDO
*endo for ! = person
*If all Sum:$ = 0 and RAN = 0 then Ps!X = 24

*Construct X matrix of everyone's choice
matrix Xnew = ononone
do ! = 1,n1
matrix Xnew = ((Xnew)'|Ps!X)'
endo
matrix Xnew = ((Xnew)'|twtwtwo)'
Do ! = n12,n
matrix Xnew = ((Xnew)'|Ps!X)'
endo
matrix Xnew = ((Xnew)'|IT)'
matrix X = X|Xnew

*specification of utility level JUST gotten by each Type 1 person
sample 1 1
gen1 t = (1/IT)**(.5)
gen1 P = (uni(UNIFP)) + P0
DO ! = 1,n1
gen1 e = NOR(UNIFE*((t)**POWERE))
sample 1 1
Do $ = 1,25
If(Ps!X .EQ. $ - 1) Ps!U:$ = ((Ps!X/24)**.66667)*&
(((1 - (Ps!X/24))/P)**.33333) + e
ENDO
*endo for $ = choice
ENDO
*for !
*specification of utility level JUST gotten by each Type 2 person
sample 1 1
gen1 t = (1/IT)**(.5)
gen1 P = (uni(UNIFP)) + P0
DO ! = n12,n
gen1 e = NOR(UNIFE*((t)**POWERE))
sample 1 1
Do $ = 1,25
If(Ps!X .EQ. $ - 1) Ps!U:$ = ((Ps!X/24)**.83333)*&
(((1 - (Ps!X/24))/P)**.16667) + e
ENDO
*for $
ENDO
*for !

endo
*for #

COMPRESS
*This is end of iteration pausit.
*&&&&&&&&&&&&&&&&&&&&&&&&&&
*&&&&&&&&&&&&&&&&&&&&&&&&&&
gen1 startit = pausit + 1
gen1 endit = 2*pausit
Do # = startit,endit
ENDIF(MaxNZPr .LE. 1)
gen1 IT = IT + 1

Do $ = 2,25
gen1 end = $-1
Do % = 1,end
Do ! = 1,n
IF(Ps!U:% .GT. Ps!U:$ .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 Ps!Pr:$ = rho*Ps!Pr:$
IF(Ps!U:$ .GT. Ps!U:% .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 Ps!PR:% = rho*Ps!Pr:%
endo
*for !
ENDO
ENDO

* Now normalize the Prob's for each person before they choose their X's
Do ? = 1,n
sample 1 25
=?STAT Ps?PR / SUMS = SUMPROB
GENR Ps?PR = (1/sumprob)*Ps?PR
endo
*for ?

Do ! = 1,n
matrix P!PrMat = (P!PrMat|(Ps!PR'|IT)')
endo

*Make choices of X's
Do ! = 1,n
SAMPLE 1 25
GENR SUM = SUM(Ps!PR)
?STAT SUM / MAXIM=M
SAMPLE 1 1
GEN1 RAN = UNI(M)
sample 1 1
IF(RAN .LT. Sum:1) Ps!X = 0
Do $ = 2,24
gen1 start = $-1
Do % = start,start
gen1 su$ = sum:%
endo
IF(Su$ .LE. RAN .AND. RAN .LT. Sum:$) Ps!X = $-1
endo
IF(Sum:24 .LE. RAN) Ps!X = 24
ENDO
*endo for ! = person
*If all Sum:$ = 0 and RAN = 0 then Ps!X = 24

*Construct X matrix of everyone's choice
matrix Xnew = ononone
do ! = 1,n1
matrix Xnew = ((Xnew)'|Ps!X)'
endo
matrix Xnew = ((Xnew)'|twtwtwo)'
Do ! = n12,n
matrix Xnew = ((Xnew)'|Ps!X)'
endo
matrix Xnew = ((Xnew)'|IT)'
matrix X = X|Xnew

*specification of utility level JUST gotten by each Type 1 person
sample 1 1
gen1 t = (1/IT)**(.5)
gen1 P = (uni(UNIFP)) + P0
DO ! = 1,n1
gen1 e = NOR(UNIFE*((t)**POWERE))
sample 1 1
Do $ = 1,25
If(Ps!X .EQ. $ - 1) Ps!U:$ = ((Ps!X/24)**.66667)*&
(((1 - (Ps!X/24))/P)**.33333) + e
ENDO
*endo for $ = choice
ENDO
*for !
*specification of utility level JUST gotten by each Type 2 person
sample 1 1
gen1 t = (1/IT)**(.5)
gen1 P = (uni(UNIFP)) + P0
DO ! = n12,n
gen1 e = NOR(UNIFE*((t)**POWERE))
sample 1 1
Do $ = 1,25
If(Ps!X .EQ. $ - 1) Ps!U:$ = ((Ps!X/24)**.83333)*&
(((1 - (Ps!X/24))/P)**.16667) + e
ENDO
*for $
ENDO
*for !

endo
*for #

COMPRESS
*This is end of iteration 2*pausit.

*&&&&&&&&&&&&&&&&&&&&&&&&&&
*&&&&&&&&&&&&&&&&&&&&&&&&&&

The preceding sets up the simulation. This is followed by one iteration initiating Probits and then by 40 more Do-Loops, each containing the number Numitest of iterations. Below is copied the 40th such Do-Loop followed by the creation of ending output files.

*&&&&&&&&&&&&&&&&&&&&&&&&&&
*&&&&&&&&&&&&&&&&&&&&&&&&&&
*Start numitest #40
gen1 startit = 2*pausit + 2 + 39*numitest
gen1 endit = 2*pausit + 1 + 40*numitest

Do # = startit,endit
ENDIF(MaxNZPr .LE. 1)
gen1 IT = IT + 1

Do $ = 2,25
gen1 end = $-1
Do % = 1,end
Do ! = 1,n
IF(Ps!U:% .GT. Ps!U:$ .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 Ps!Pr:$ = rho*Ps!Pr:$
IF(Ps!U:% .GT. Ps!U:$ .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
gen1 Y$o%:! = 0
IF(Ps!U:$ .GT. Ps!U:% .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 Ps!PR:% = rho*Ps!Pr:%
IF(Ps!U:$ .GT. Ps!U:% .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
gen1 Y$o%:! = 1
IF(Ps!U:% .EQ. -9 .OR. Ps!U:$ .EQ. -9)
gen1 Y$o%:! = -9
endo
*for !
ENDO
ENDO

*Count no. of pairs ranked by both ! and ?; Need for Probits.
Do ? = 1,n
gen1 end = ? - 1
Do ! = 1,end
gen1 t? = 0
Do $ = 2,25
gen1 end = $-1
Do % = 1,end
IF(Y$o%:? .ne. -9)
gen1 t? = t? + 1
endo
endo
endo
endo

* 1st choose 1's nbrs
*replace p1a:1 with 0 in vector p1a
COPY p1a p1a1st / FROW=2;9 TROW=1;8
gen1 zero = 0
matrix p1a1st = (zero|p1a1st')'

sample 1 n
GENR SUM1A = SUM(p1a1st)
?STAT SUM1A / MAXIM=smpnbr1
gen1 RANDOM = UNI(smpnbr1)

*pick 1's 1st neighbor:
sample 1 1
IF(RANDOM .LT. Sum1A:2) person1:1 = 2
Do ? = 3,nsamp
gen1 start = ?-1
Do % = start,start
gen1 spbr? = Sum1A:%
endo
sample 1 1
IF(spbr? .LE. RANDOM .AND. &
RANDOM .LT. Sum1A:?) person1:1 = ?

endo
* for ?
IF(Sum1A:8 .LE. RANDOM) person1:1 = 9

*pick 1's 2nd neighbor:
gen1 k = (person1:1) - 1
COPY p1a1st p1a2nda / FROW=1;k TROW=1;k
gen1 j = (person1:1) + 1
gen1 h = n-j+1
IF(person1:1 .LE. n-1)
COPY p1a1st p1a2ndb / FROW=j;n TROW=1;h
IF(person1:1 .LE. n-1)
MATRIX p1a2nd = (p1a2nda'|zero|p1a2ndb')'
IF(person1:1 .EQ. n)
MATRIX p1a2nd = (p1a2nda'|zero)'
DELETE p1a2nda
IF(person1:1 .LE. n-1)
DELETE p1a2ndb

sample 1 n
GENR SUM1B = SUM(p1a2nd)
?STAT SUM1B / MAXIM=smpnbr1
gen1 RANDOM = UNI(smpnbr1)

*Since the coord of p1a2nd corresponding to person1:1 is zero,
*then the following procedure cannot choose person1:2 = person1:1
sample 1 1
IF(RANDOM .LT. Sum1B:2) person1:2 = 2
Do ? = 3,nsamp
gen1 start = ?-1
Do % = start,start
gen1 spbr? = Sum1B:%
endo
IF(spbr? .LE. RANDOM .AND. &
RANDOM .LT. Sum1B:?) person1:2 = ?
endo
*for ?
IF(Sum1B:8 .LE. RANDOM) person1:2 = 9

* Now choose two nbrs for people 2, ..., n-1
Do ! = 2,nsamp
gen1 k = !-1
COPY p!a p!a1stA / FROW=1;k TROW=1;k
gen1 j = !+1
gen1 h = n-j+1
COPY p!a p!a1stB / FROW=j;n TROW=1;h
MATRIX p!a1st = (p!a1stA'|zero|p!a1stB')'
DELETE p!a1stA p!a1stB

sample 1 n
GENR SUM!A = SUM(p!a1st)
?STAT SUM!A / MAXIM=smpnbr!
gen1 RANDOM = UNI(smpnbr!)

*pick !'s 1st neighbor:
sample 1 1
IF(RANDOM .LT. Sum!A:1) person!:1 = 1
Do ? = 2,nsamp
gen1 start = ?-1
Do % = start,start
gen1 spbr? = Sum!A:%
endo
sample 1 1
IF(spbr? .LE. RANDOM .AND. &
RANDOM .LT. Sum!A:?) person!:1 = ?
endo
IF(Sum!A:8 .LE. RANDOM) person!:1 = 9

*pick !'s 2nd neighbor:
gen1 h = nsamp
IF(person!:1 .EQ. 1)
COPY p!a1st p!a2ndA / FROW=2;n TROW=1;h
IF(person!:1 .EQ. 1)
MATRIX p!a2nd = (zero|p!a2ndA')'
IF(person!:1 .EQ. 1)
DELETE p!a2ndA
gen1 k = (person!:1) - 1
IF(1 .LT. person!:1 .AND. &
person!:1 .LE. n-1)
COPY p!a1st p!a2ndA / FROW=1;k TROW=1;k
gen1 j = (person!:1) + 1
gen1 h = n-j+1
IF(1 .LT. person!:1 .AND. &
person!:1 .LE. n-1)
COPY p!a1st p!a2ndB / FROW=j;n TROW=1;h
IF(1 .LT. person!:1 .AND. &
person!:1 .LE. n-1)
MATRIX p!a2nd = (p!a2ndA'|zero|p!a2ndB')'
IF(1 .LT. person!:1 .AND. &
person!:1 .LE. n-1)
DELETE p!a2ndA p!a2ndB
IF(person!:1 .EQ. n)
COPY p!a1st p!a2ndA / FROW=1;8 TROW=1;8
IF(person!:1 .EQ. n)
MATRIX p!a2nd = (p!a2ndA'|zero)'
IF(person!:1 .EQ. n)
DELETE p!a2ndA

sample 1 n
GENR SUM!B = SUM(p!a2nd)
?STAT SUM!B / MAXIM=smpnbr!
gen1 RANDOM = UNI(smpnbr!)
sample 1 1
IF(RANDOM .LT. Sum!B:1) person!:2 = 1
Do ? = 2,nsamp
gen1 start = ?-1
Do % = start,start
gen1 spbr? = Sum!B:%
endo
IF(spbr? .LE. RANDOM .AND. &
RANDOM .LT. Sum!B:?) person!:2 = ?
endo
*for ?
IF(Sum!B:8 .LE. RANDOM) person!:2 = 9
ENDO
*for !

* Last choose 9's two nbrs
COPY p9a p9a1st / FROW=1;8 TROW=1;8
matrix p9a1st = (p9a1st'|zero)'
sample 1 n
GENR SUM9A = SUM(p9a1st)
?STAT SUM9A / MAXIM=smpnbr9
gen1 RANDOM = UNI(smpnbr9)

*pick 9's 1st neighbor:
sample 1 1
IF(RANDOM .LT. Sum9A:1) person9:1 = 1
Do ? = 2,nsamp
gen1 start = ?-1
Do % = start,start
gen1 spbr? = Sum9A:%
endo
sample 1 1
IF(spbr? .LE. RANDOM .AND. &
RANDOM .LT. Sum9A:?) person9:1 = ?
endo

*pick 9's 2nd neighbor:
gen1 h = nsamp
IF(person9:1 .EQ. 1)
COPY p9a1st p9a2ndA / FROW=2;n TROW=1;h
IF(person9:1 .EQ. 1)
MATRIX p9a2nd = (zero|p9a2ndA')'
IF(person9:1 .EQ. 1)
DELETE p9a2ndA
gen1 k = (person9:1) - 1
IF(1 .LT. person9:1 .AND. &
person9:1 .LE. n-1)
COPY p9a1st p9a2ndA / FROW=1;k TROW=1;k
gen1 j = (person9:1) + 1
gen1 h = n-j+1
IF(1 .LT. person9:1 .AND. &
person9:1 .LE. n-1)
COPY p9a1st p9a2ndB / FROW=j;n TROW=1;h
IF(1 .LT. person9:1 .AND. &
person9:1 .LE. n-1)
MATRIX p9a2nd = (p9a2ndA'|zero|p9a2ndB')'
IF(1 .LT. person9:1 .AND. &
person9:1 .LE. n-1)
DELETE p9a2ndA p9a2ndB

sample 1 n
GENR SUM9B = SUM(p9a2nd)
?STAT SUM9B / MAXIM=smpnbr9
gen1 RANDOM = UNI(smpnbr9)
sample 1 1
IF(RANDOM .LT. Sum9B:1) person9:2 = 1
Do ? = 2,nsamp
gen1 start = ?-1
Do % = start,start
gen1 spbr? = Sum9B:%
endo
IF(spbr? .LE. RANDOM .AND. &
RANDOM .LT. Sum9B:?) person9:2 = ?
endo
*end choice of 9's two nbrs

Do ! = 1,n
matrix NewNbr! = person!:1
Do ? = 2,NNBR
matrix NewNbr! = (NewNbr!'|person!:?)'
endo
endo
matrix NewNbr = NewNbr1
Do ! = 2,n
matrix NewNbr = (NewNbr'|NewNbr!')'
endo
matrix NewNbr = (NewNbr'|IT)'
matrix NbrMat = NbrMat|NewNbr

*This gives 0-1 variable to use in probit to compare !'s and ?'s tastes
Do ! = 1,n
matrix Y! = Y2o1:!
Do $ = 3,25
gen1 end = $ - 1
Do % = 1,end
matrix Y! = (Y!'|Y$o%:!)'
endo
endo
endo

*Now paste together vectors used in Probits
Do ! = 1,n
matrix Ynbr! = Y!
Do ? = 1,NNBR
gen1 n!rank? = 0
gen1 begin = person!:?
gen1 end = person!:?
Do % = begin,end
matrix Ynbr! = (Ynbr!'|Y%')'
matrix Y!a? = (Y!'|Y%')'
gen1 n!rank? = t%
endo
endo
endo

Do ! = 1,n
sample 1 900
delete FACE!
sample 1 300
genr FACE! = Lab!
endo

Do ! = 1,n
gen1 vary! = 1
Do ? = 1,NNBR
gen1 begin = person!:?
gen1 end = person!:?
Do % = begin,end
gen1 vary! = vary!*i!a%
matrix Face! = (Face!'|LABEL%')'
endo
endo
endo

*Each person ! uses Probit to est posterior prob that ? is "Same" as !
Do ! = 1,n
GEN1 NObs = pausit - 1
GEN1 KObs = 0
GEN1 tFace = 0

gen1 range = 300*(NNBR+1)
sample 1 range
SKIPIF(Ynbr! .eq. -9)

IF(t! .GE. 120 .AND. n!rank1 .GE. 120 &
.AND. n!rank2 .GE. 120 .AND. vary! .EQ. 0)
?probit Ynbr!
IF(t! .GE. 120 .AND. n!rank1 .GE. 120 &
.AND. n!rank2 .GE. 120 .AND. vary! .EQ. 0)
GEN1 NObs = $N

IF(t! .GE. 120 .AND. n!rank1 .GE. 120 &
.AND. n!rank2 .GE. 120 .AND. vary! .EQ. 0)
probit Ynbr! X1 X2 X3 Face! / Tratio=tratio

sample 1 1
IF(t! .GE. 120 .AND. n!rank1 .GE. 120 &
.AND. n!rank2 .GE. 120 .AND. vary! .EQ. 0)
GEN1 KObs = $K
IF(t! .GE. 120 .AND. n!rank1 .GE. 120 &
.AND. n!rank2 .GE. 120 .AND. vary! .EQ. 0)
gen1 tFace = abs(Tratio:4)
gen1 TDF = NObs - KObs
DISTRIB tFace / Type=t DF=TDF
Gen1 P!LTS = 2*(1-$CDF)

DELETE SKIP$

endo
*for !

* ***construct for each ! pairwise Probit comparisons of rankings with neighbors
Do ! = 1,n
Do ? = 1,NNBR

GEN1 NObs = pausit - 1
GEN1 KObs = 0
GEN1 tSAME = 0

sample 1 600
SKIPIF(Y!a? .eq. -9)


IF(t!.GE. 175 .AND. n!rank? .GE. 175)
probit Y!a? X1doub X2doub X3doub D/ Tratio=trat
sample 1 1
IF(t!.GE. 175 .AND. n!rank? .GE. 175)
GEN1 KObs = $K
IF(t!.GE. 175 .AND. n!rank? .GE. 175)
gen1 tSAME = abs(Trat:4)
gen1 TDF = NObs - KObs
DISTRIB tSAME / Type=t DF=TDF
Gen1 P!Sa? = 2*(1-$CDF)

DELETE SKIP$

endo
*for ?
endo
*for !

matrix NewTTest = P1LTS
Do ! = 2,n
matrix NewTTest = (NewTTest'|(P!LTS))'
endo
matrix NewTTest = (NewTTest'|IT)'
matrix PrTTest = (PrTTest|NewTTest)

Do ! = 1,n
Do ? = 1,n
IF(Lab! .NE. Lab? .AND. &
P!LTS .LT. 1.00000000000000)
gen1 Q!a:? = (.5)*Q!a:?
IF(Lab! .NE. Lab? .AND. &
P!LTS .LT. 1.00000000000000)
gen1 P!a:? = (rhosame + P!LTS)*P!a:?
gen1 P!a:? = P!a:?/(P!a:? + Q!a:?)
gen1 Q!a:? = 1 - P!a:?
endo
endo

*Second revise prob's just for !'s neighbors using !'s guesses from pairwise
Do ! = 1,n
Do ? = 1,NNBR
gen1 begin = person!:?
gen1 end = person!:?
Do % = begin,end
IF(P!Sa? .LT. 1.00000000000000)
gen1 Q!a:% = (.5)*(1-P!a:%)
IF(P!Sa? .LT. 1.00000000000000)
gen1 P!a:% = (P!Sa?)*P!a:%
gen1 P!a:% = (1/(P!a:% + Q!a:%))*P!a:%
gen1 Q!a:% = 1 - P!a:%
endo
endo
endo

Do ! = 1,n
matrix P!SaMat = (P!SaMat|(P!a'|IT)')
endo

* ** Finally, use posterior probs that are SAME/DIFF to revise Ps!Pr$ 's
Do ! = 1,n
Do ? = 1,NNBR
gen1 begin = person!:?
gen1 end = person!:?
Do % = begin,end
Do $ = 2,25
gen1 end = $-1
Do @ = 1,end
IF(Ps%U:@ .GT. Ps%U:$ .AND. Ps%U:@ .NE. -9 &
.AND. Ps%U:$ .NE. -9)
GEN1 Ps!Pr:$ = ((rho*P!a:%)+(Q!a:%))*Ps!Pr:$
IF(Ps!U:@ .GT. Ps!U:$ .AND. Ps!U:@ .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 Ps%Pr:$ = ((rho*P%a:!)+(Q%a:!))*Ps%Pr:$
IF(Ps%U:$ .GT. Ps%U:@ .AND. Ps%U:@ .NE. -9 &
.AND. Ps%U:$ .NE. -9)
GEN1 Ps!Pr:@ = ((rho*P!a:%)+(Q!a:%))*Ps!Pr:@
IF(Ps!U:$ .GT. Ps!U:@ .AND. Ps!U:@ .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 Ps%Pr:@ = ((rho*P%a:!)+(Q%a:!))*Ps%Pr:@
endo
*for @
ENDO
*for $
ENDO
*for %
endo
*for ?
endo
*for !

* Now normalize the Prob's for each person before they choose their X's
Do ? = 1,n
sample 1 25
=?STAT Ps?PR / SUMS = SUMPROB
GENR Ps?PR = (1/sumprob)*Ps?PR
endo
*for ?

Do ! = 1,n
matrix P!PrMat = (P!PrMat|(Ps!PR'|IT)')
endo

*Make choices of X's
Do ! = 1,n
SAMPLE 1 25
GENR SUM = SUM(Ps!PR)
?STAT SUM / MAXIM=M
SAMPLE 1 1
GEN1 RAN = UNI(M)
sample 1 1
IF(RAN .LT. Sum:1) Ps!X = 0
Do $ = 2,24
gen1 start = $-1
Do % = start,start
gen1 su$ = sum:%
endo
IF(Su$ .LE. RAN .AND. RAN .LT. Sum:$) Ps!X = $-1
endo
IF(Sum:24 .LE. RAN) Ps!X = 24
ENDO
*endo for ! = person
*If all Sum:$ = 0 and RAN = 0 then Ps!X = 24

*Construct X matrix of everyone's choice
matrix Xnew = ononone
do ! = 1,n1
matrix Xnew = ((Xnew)'|Ps!X)'
endo
matrix Xnew = ((Xnew)'|twtwtwo)'
Do ! = n12,n
matrix Xnew = ((Xnew)'|Ps!X)'
endo
matrix Xnew = ((Xnew)'|IT)'
matrix X = X|Xnew


*specification of utility level JUST gotten by each Type 1 person
sample 1 1
gen1 t = (1/IT)**(.5)
gen1 P = (uni(UNIFP)) + P0
DO ! = 1,n1
gen1 e = NOR(UNIFE*((t)**POWERE))
sample 1 1
Do $ = 1,25
If(Ps!X .EQ. $ - 1) Ps!U:$ = ((Ps!X/24)**.66667)*&
(((1 - (Ps!X/24))/P)**.33333) + e
ENDO
*endo for $ = choice
ENDO
*for !
*specification of utility level JUST gotten by each Type 2 person
sample 1 1
gen1 t = (1/IT)**(.5)
gen1 P = (uni(UNIFP)) + P0
DO ! = n12,n
gen1 e = NOR(UNIFE*((t)**POWERE))
sample 1 1
Do $ = 1,25
If(Ps!X .EQ. $ - 1) Ps!U:$ = ((Ps!X/24)**.83333)*&
(((1 - (Ps!X/24))/P)**.16667) + e
ENDO
*for $
ENDO
*for !

*&&&&&&&&&&&&&&&&&&&&
*count no. of prob's greater than 0 to decide at start of next iteration whether to terminate
sample 1 1
Do ! = 1,n
GEN1 Count! = 0
DO $=1,25
IF(Ps!PR:$ .GE. 0.001)Count! = Count! + 1
ENDO
*endo for $
endo
*for !

delete count
sample 1 1
gen1 MaxNZPr = 0
genr Count = ononone
Do !=1,n1
gen1 MaxNZPr = max(MaxNZPr,Count!)
matrix Count = ((Count)'|Count!)'
endo
matrix Count = ((Count)'|twtwtwo)'
Do !=n12,n
gen1 MaxNZPr = max(MaxNZPr,Count!)
matrix Count = ((Count)'|Count!)'
endo

matrix Count = ((Count)'|IT)'
matrix CountMat = (CountMat|Count)
*&&&&&&&&&&&&&&&&&&&&

endo
*for #

COMPRESS
*This is end of iteration 2*pausit + 1 + 40*numitest
*End of numitest #40

* **************Finally THE END
* ************** THE END

sample 1 naug
format(f3.0,140f5.0)
write(XNaive6x3x2rho.5It10) X / format

sample 1 n
format(f3.0,140f5.0)
write(CtMatNaive6x3x2rho.5It10) CountMat / format

sample 1 26
Do ! = 1,n
format(f3.0,140f7.3)
write(P!PrNaive6x3x2rho.5It10) P!PrMat / format
endo

sample 1 nplus1
Do ! = 1,n
format(f3.0,140f7.3)
write(P!SaNaive6x3x2rho.5It10) P!SaMat / format
endo

sample 1 nplus1
format(f3.0,140f7.3)
write(TTestNaive6x3x2rho.5It10) PrTTest / format

sample 1 nplus1
format(140f5.0)
write(NbrMatNaive6x3x2rho.5It10) NbrMat / format

* **************
* **************
*below to double ****'s constructs ranking matrix for each person !

Do $ = 2,25
gen1 end = $ - 1
Do % = 1,end
Do ! = 1,n
gen1 r!k$o% = -9
endo
endo
endo

Do $=1,25
Do ! = 1,n
gen1 r!k$o$ = 0
endo
endo

Do $ = 2,25
gen1 end = $-1
Do % = 1,end
Do ! = 1,n
IF(Ps!U:% .GT. Ps!U:$ .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 r!k$o% = -1
IF(Ps!U:$ .GT. Ps!U:% .AND. Ps!U:% .NE. -9 &
.AND. Ps!U:$ .NE. -9)
GEN1 r!k$o% = 1
endo
*for !
ENDO
ENDO

*the variable r!k$o% = 1 iff ! ranks $ over %; = -1 if % preferred to $;
* = 0 if $ indifferent to % and = -9 if has no info comparing $ and %
* and = 2 if not doing ranking: only do on diag & below.
*First tricks to create left border listing choices on printout of rankings

Do ! = 1,n

gen1 zero = 0
sample 1 26
genr P!ref = time(-2)

matrix P!ref1 = zero
do $ = 1,25
matrix P!ref1 = ((P!ref1)'|r!k$o1)'
endo

gen1 two = 2
Do %=2,25
matrix P!ref% = %-1
gen1 end = % - 1
gen1 start = %
Do $=1,end
matrix P!ref% = ((P!ref%)'|two)'
endo
do $ = start,25
matrix P!ref% = ((P!ref%)'|r!k$o%)'
endo
endo

do % = 1,25
matrix P!ref = P!ref|P!ref%
endo

FORMAT(26F4.0)
write(BBd!Naive6x3x2rho.5It10) P!ref / FORMAT

endo
*for !
* **************
* **************

STOP