Saturday, April 9, 2011

Myers-Briggs Test in Python apparently uses this method - Myers-Briggs Test is a psychology, profile evaluation system, expanded upon later by David Keirsey. We coded the evaluation scheme in Python, making a few additions. In the original version in David Keirsey book Please Understand Me II, the answer to each question is either A, or B, these choices in Python code as -1, +1 then sum up appropiate array values. Recent versions of this questionaire carry more (sometimes even five) choices. We noticed an additional 'neutral' choice can made an improvement, our version carries 3 answers. Eval code substitutes -1 for A, +1 for B, and 0 for neutral.

An example of the evaluation algorithm Keirsey uses in his book is above. We simply generate indexes that correspond to the columns seen above (answers arrive in a straight list, numbered from 1 to 70), then do the addition.
def calculate_mb(choices):

new_choices = []

for i in range(1,8):
new_choices.append([int(choices[j-1]) for j in range(i,71,7) ])

res = list("XXXX")

ei = sum(new_choices[0])
if ei < 0: res[0] = 'E'
else: res[0] = 'I'

sn = sum(new_choices[1]) + sum(new_choices[2])
if sn < 0: res[1] = 'S'
else: res[1] = 'N'

tf = sum(new_choices[3]) + sum(new_choices[4])
if tf < 0: res[2] = 'T'
else: res[2] = 'F'

jp = sum(new_choices[5]) + sum(new_choices[6])
if jp < 0: res[3] = 'J'
else: res[3] = 'P'


return str(''.join(res))
The running version of this test is on appspot.