Saturday, 8 September 2012

The Hexaco Personality Inventory - SPSS Script

I am currently using the 60-item version of the Hexaco-PI-R personality inventory and decided to write a short script for SPSS to help speed up the coding process. I have posted it below because I couldn't find anyone else who had posted one online.

All items should be labeled as separate numeric variables as hexaco1, hexaco2, hexaco3 ...etc

The script computes and prints the results for all reverse scored items and then calculates and prints Factor/ Facet scores. It will also produce Cronbach's Alpha coefficients for each factor.

The original scoring key for the HEXACO-PI-R can be found here.



*******************************************

*Part 1 - reverse scoring of specific items

*Honesty-Humility

COMPUTE rhexaco30 = 6 - hexaco30.
EXECUTE.
COMPUTE rhexaco12 = 6 - hexaco12.
EXECUTE.
COMPUTE rhexaco60 = 6 - hexaco60.
EXECUTE.
COMPUTE rhexaco42 = 6 - hexaco42.
EXECUTE.
COMPUTE rhexaco24 = 6 - hexaco24.
EXECUTE.
COMPUTE rhexaco48 = 6 - hexaco48.
EXECUTE.

*Emotionality

COMPUTE rhexaco53 = 6 - hexaco53.
EXECUTE.
COMPUTE rhexaco35 = 6 - hexaco35.
EXECUTE.
COMPUTE rhexaco41 = 6 - hexaco41.
EXECUTE.
COMPUTE rhexaco59 = 6 - hexaco59.
EXECUTE.

*Extraversion

COMPUTE rhexaco28 = 6 - hexaco28.
EXECUTE.
COMPUTE rhexaco52 = 6 - hexaco52.
EXECUTE.
COMPUTE rhexaco10 = 6 - hexaco10.
EXECUTE.
COMPUTE rhexaco46 = 6 - hexaco46.
EXECUTE.

*Agreeableness

COMPUTE rhexaco9 = 6 - hexaco9.
EXECUTE.
COMPUTE rhexaco15 = 6 - hexaco15.
EXECUTE.
COMPUTE rhexaco57 = 6 - hexaco57.
EXECUTE.
COMPUTE rhexaco21 = 6 - hexaco21.
EXECUTE.

*Conscientiousness 

COMPUTE rhexaco26 = 6 - hexaco26.
EXECUTE.
COMPUTE rhexaco32 = 6 - hexaco32.
EXECUTE.
COMPUTE rhexaco14 = 6 - hexaco14.
EXECUTE.
COMPUTE rhexaco20 = 6 - hexaco20.
EXECUTE.
COMPUTE rhexaco44 = 6 - hexaco44.
EXECUTE.
COMPUTE rhexaco56 = 6 - hexaco56.
EXECUTE.

*Openness

COMPUTE rhexaco1 = 6 - hexaco1.
EXECUTE.
COMPUTE rhexaco31 = 6 - hexaco31.
EXECUTE.
COMPUTE rhexaco49 = 6 - hexaco49.
EXECUTE.
COMPUTE rhexaco19= 6 - hexaco19.
EXECUTE.
COMPUTE rhexaco55 = 6 - hexaco55.
EXECUTE.

*******************************************

*Part 2 - calculating factor and facet scores

COMPUTE Honesty_Humility = (hexaco6+hexaco54+hexaco36+hexaco18+rhexaco30+rhexaco12+rhexaco60+rhexaco42+rhexaco24+rhexaco48)/10.
EXECUTE.
COMPUTE Sincerity = (hexaco6+hexaco54+rhexaco30)/3.
EXECUTE.
COMPUTE Fairness = (hexaco36+rhexaco12+rhexaco60)/3.
EXECUTE.
COMPUTE Greed_Avoidance = (hexaco18+rhexaco42)/2.
EXECUTE.
COMPUTE Modesty = (rhexaco24+rhexaco48)/2.
EXECUTE.

COMPUTE Emotionality = (hexaco5+hexaco29+hexaco11+hexaco17+hexaco23+hexaco47+rhexaco53+rhexaco35+rhexaco41+rhexaco59)/10.
EXECUTE.
COMPUTE Fearfulness = (hexaco5+hexaco29+rhexaco53)/3.
EXECUTE.
COMPUTE Anxiety = (hexaco11+rhexaco35)/2.
EXECUTE.
COMPUTE Dependence = (hexaco17+rhexaco41)/2.
EXECUTE.
COMPUTE Sentimentality = (hexaco23+hexaco47+rhexaco59)/3.
EXECUTE.


COMPUTE Extraversion = (hexaco4+hexaco34+hexaco58+hexaco16+hexaco40+hexaco22+rhexaco28+rhexaco52+rhexaco10+rhexaco46)/10.
EXECUTE.
COMPUTE Social_Self_esteem = (hexaco4+rhexaco28+rhexaco52)/3.
EXECUTE.
COMPUTE Social_Boldness = (hexaco34+hexaco58+rhexaco10)/3.
EXECUTE.
COMPUTE Sociability = (hexaco16+hexaco40)/2.
EXECUTE.
COMPUTE Liveliness = (hexaco22+rhexaco46)/2.
EXECUTE.


COMPUTE Agreeableness = (hexaco3+hexaco27+hexaco33+hexaco51+hexaco39+hexaco45+rhexaco9+rhexaco15+rhexaco57+rhexaco21)/10.
EXECUTE.
COMPUTE Forgiveness = (hexaco3+hexaco27)/2.
EXECUTE.
COMPUTE Gentleness = (hexaco33+hexaco51+rhexaco9)/3.
EXECUTE.
COMPUTE Flexibility = (hexaco39+rhexaco15+rhexaco57)/3.
EXECUTE.
COMPUTE Patience = (hexaco45+rhexaco21)/2.
EXECUTE.

COMPUTE Conscientiousness =(hexaco2+hexaco8+hexaco38+hexaco50+rhexaco26+rhexaco32+rhexaco14+rhexaco20+rhexaco44+rhexaco56)/10.
EXECUTE.
COMPUTE Organization = (hexaco2+rhexaco26)/2.
EXECUTE.
COMPUTE Diligence = (hexaco8+rhexaco32)/2.
EXECUTE.
COMPUTE Perfectionism = (hexaco38+hexaco50+rhexaco14)/3.
EXECUTE.
COMPUTE Prudence = (rhexaco20+rhexaco44+rhexaco56)/3.
EXECUTE.


COMPUTE Openness_to_Experience = (hexaco25+hexaco7+hexaco13+hexaco37+hexaco43+rhexaco1+rhexaco31+rhexaco49+rhexaco19+rhexaco55) /10.
EXECUTE.
COMPUTE Aestheic_Appreciation = (hexaco25+rhexaco1)/2.
EXECUTE.
COMPUTE Inquisitiveness = (hexaco7+rhexaco31)/2.
EXECUTE.
COMPUTE Creativity = (hexaco13+hexaco37+rhexaco49)/3.
EXECUTE.
COMPUTE Unconventionality = (hexaco43+rhexaco19+rhexaco55)/3.
EXECUTE.


*******************************************

*Part 3 Calculating reliability scores (Cronbach Alpha) for each factor

* Honest humility

RELIABILITY
  /VARIABLES=hexaco6 hexaco54 hexaco36 hexaco18 rhexaco30 rhexaco12 rhexaco60 rhexaco42 rhexaco24 rhexaco48
  /SCALE('ALL VARIABLES') ALL
  /MODEL=ALPHA.

*Emotionality

RELIABILITY
  /VARIABLES=hexaco5 hexaco29 hexaco11 hexaco17 hexaco23 hexaco47 rhexaco53 rhexaco35 rhexaco41 rhexaco59
  /SCALE('ALL VARIABLES') ALL
  /MODEL=ALPHA.

*Extraversion

RELIABILITY
  /VARIABLES=hexaco4 hexaco34 hexaco58 hexaco16 hexaco40 hexaco22 rhexaco28 rhexaco52 rhexaco10 rhexaco46
  /SCALE('ALL VARIABLES') ALL
  /MODEL=ALPHA.

*Agreeableness

RELIABILITY
  /VARIABLES=hexaco3 hexaco27 hexaco33 hexaco51 hexaco39 hexaco45 rhexaco9 rhexaco15 rhexaco57 rhexaco21
  /SCALE('ALL VARIABLES') ALL
  /MODEL=ALPHA.

*Conscientiousness

RELIABILITY
  /VARIABLES=hexaco2 hexaco8 hexaco38 hexaco50 rhexaco26 rhexaco32 rhexaco14 rhexaco20 rhexaco44 rhexaco56
  /SCALE('ALL VARIABLES') ALL
  /MODEL=ALPHA.

*Opennes to experience

RELIABILITY
  /VARIABLES=hexaco25 hexaco7 hexaco13 hexaco37 hexaco43 rhexaco1 rhexaco31 rhexaco49 rhexaco19 rhexaco55
  /SCALE('ALL VARIABLES') ALL
  /MODEL=ALPHA.



Sunday, 2 September 2012

Network analysis: Where are you in my social network?

Michael Slater-Townshend talks extensively about the merits of understanding your own and other online communities in this in this months Royal Statistical Society magazine. After following his advice, I have discovered that it is surprisingly easy to download your own Facebook data and see which of your friends form connected groups.

Several apps allow you to download 'raw' Facebook data in a format that suits almost any statistical package. I used NameGenWeb. The resulting file can then be imported into a variety of statistical packages. I chose to use Gelphi for this example.

My unprocessed Facebook network looks like this...
Each dot (or node) is a friend and the lines show friendship connections between each individual. 

In order to make things manageable, I ran a cluster-analysis to look for groups of people who are more connected to each other. This quickly produced three distinct groups. The larger circles represent clusters of 3 or more people who share many connections. 


The dark purple, yellow and pink nodes are difficult to categorize because they don't fit well into any of the defined groups. Those who sit in the middle could be described as being at the epicentre of my [Facebook] existence because they have strong links with all three clusters. Each individual can be identified from this model, but I opted to remove the name tags for clarity.


Of course this network is virtual and constantly changing as it relies on the behavioural patterns of nearly 350 individual data points. For many people, the resulting network may not reflect their real life social interaction. For example, I almost never see people in the school cluster with the exception of one large orange circle. This shows a minority of 3 close friends from school who I have continue to socialise with on a regular basis. 

There are many applications for this type of analysis, particularly when it comes to comparing real life and online social interaction. Other research has started to suggest that Facebook and Twitter status updates may also help predict personality. How these networks change and evolve over time (assuming Facebook is still around in 20 years) would presumably give a valuable insight into how friendship groups change as we age.

As you can probably imagine, the vast amounts of present information has already become a valuable source of information for any future employer or recruitment agency!