I was asked to create a program that would plot a person’s Big 5 personality within this political theory:
A typical output would look something like this:
The problem is to take a person’s Big 5 percentiles and position them on a triangle model of political preference. This triangle has three axes from a corner to the midpoint of the opposite line. We’ll name the points like so for discussion:
Since the idea is simply to show the position graphically, I made a number of simplifying decisions:
1) I created the triangle such that the length of each axis (AE, BF, and CG) would be 10.
That way, the 80th percentile of Openness can be mapped to 80% along the axis from C to G, and so on.
Then it becomes a simple distance formula problem where e.g. 80% of the distance of 10 is 8.
2) I decided to do everything in Cartesian coordinates.
3) The sixth point, representing a person’s political tendency after putting all five axes together, is just the average of the other points and can be calculated like a center of mass problem.
4) I worked in quadrant 1 of the Cartesian coordinates to avoid errors from minus signs and, eventually, to make it easier to represent visually in most computer programs.
The easiest way to do this is to find the coordinates of all the points. Then, find the equations for the lines AE, BF, and CG. Then, create functions for positioning the Big 5 points along the line segments. Last, average the x and y-coordinates of these five points to get the x and y-coordinates of the point we want.
C is the easiest point to locate. Since the line segment is a distance of 10 from the y-axis and C lies on the x-axis by construction, C = (10, 0).
The next easiest is A. For that we look at the right triangle formed by A, C, and G. We don’t know the length of the hypotenuse AC or the length of the shorter side AG, but we know that 2AG = AC because G is the midpoint of AB by construction and AB = AC. That means we can calculate the hypotenuse using the Pythagorean theorem like so:
AC^2 = AG^2 + CG^2
AC^2 = (AC/2)^2 + CG^2
AC^2 = (AC^2)/4 + 10^2
(3/4) AC^2 = 100
AC^2 = 400/3
AC = sqrt(400/3)
AC = sqrt(400)/sqrt(3)
AC = 20/sqrt(3)
Fortunately, the rest will be easier. B is on the y-axis at half the height of A, so its coordinates are 0 and half of 20/sqrt(3), or (0, 10/sqrt(3)).
G is the midpoint of AB, so we can just take the average of the x and y-coordinates of A and B.
A = (10, 20/sqrt(3))
B = (0, 10/sqrt(3))
Midpoint of x-coordinates = 1/2 * (10 + 0) = 5.
Midpoint of y-coordinates = 1/2 * (20/sqrt(3) + 10/sqrt(3)) = 1/2 * (30/sqrt(3)) = 15/sqrt(3).
Therefore G = (5, 15/sqrt(3)).
By using the same basic method (and skipping over the tedious details), we can find that E = (5, 5/sqrt(3)) and F = (10, 10/sqrt(3)).