# How to organise an iterative manual rotation of n component pairs?

I am currently building a q.rotate() function for the qmethod R package for Q Methodology.

As is desirable for Q, I'd like users to be able to iteratively rotate any given component pair loadings from a principal components analysis (PCA).

Like so (early draft):

Crucially, users should be able to go back to already rotated pairs, and continue rotating them.

This is giving me some headaches, because rotations don't commute, so the order in which rotations are done matters.

This is not a technical question on how to implement this in R.

I am wondering how to organise this from a statistical procedure.

I don't know whether what I'm planning makes any sense.

Let's say I have three retained components: f1, f2, f3, and this is their (unrotated) loadings matrix:

# suppose I have some ORIGINAL loadings matrix, from a principal components analysis, with three retained components
loa.orig <- cbind(c(0.6101496, 0.7114088, 0.3356003, 0.7318809, 0.5980133, 0.4102817, 0.7059148, 0.6080662, 0.5089014, 0.587025, 0.6166816, 0.6728603, 0.7482675, 0.5409658, 0.6415472, 0.3655053, 0.6313868), c(-0.205317, 0.3273207, 0.7551585, -0.1981179, -0.423377, -0.07281187, -0.04180098, 0.5003459, -0.504371, 0.1942334, -0.3285095, 0.5221494, 0.1850734, -0.2993066, -0.08715662, -0.02191772, -0.2002428), c(-0.4692407, 0.1581682, -0.04574932, -0.1189175, 0.2449018, -0.5283772, 0.02826476, 0.1703277, 0.2305158, 0.2135566, -0.2783354, -0.05187637, -0.104919, 0.5054129, -0.2403471, 0.5380329, -0.07999642))


Here's a draft order of things for the iteration:

1. User chooses a component pair from the combinations of factors one of columns from combs <- combn(x = ncol(loa.orig), m = 2, simplify = TRUE)
2. User enters an angle in degrees to rotate the given factor pair, say f1 vs f2, say 5° clockwise.
3. f1 and f2 are rotated 5° clockwise
4. all plots involving either f1 or f2 are updated, because they all change. (correct?)
5. User enters another angle to try out, say 10°, still on f1 and f2
6. repeat steps 3, 4, 5 as long as the user wants
7. user indicates that she is done with f1 and f2.
8. the rotated loadings matrix is saved to, say loa.rot
9. return to step 1, now all rotations, say between f2 and f3 are done on the rotated loa.rot from the past loop.
10. repeat steps 1-9.
11. once user indicates that she is done with all factor pairs, last loa.rot is returned.

Does that make sense?

PS:

There is an additional problem. Obviously, I'd like for this procedure to be reproducible, preferably without saving all the steps the user took. (They may be redundant). Instead, to create a reproducible "recipe" for this by-hand rotation, I would take the final loa.rot and compute the simplest step of rotations required to arrive at the final loa.rot from the initial loa.orig. No idea yet how to do that, that's a different question.

• This sounds like a question on user interface, not on statistics. Jul 18 '15 at 13:40
• Regarding your question on stackoverflow, the answer is simple: you should store the final rotation matrix of all components (3 in this case), i.e. 3x3 rotation matrix. You sequence of planar rotations can always be combined together in such a matrix. Jul 18 '15 at 13:41
• apologies if this is off-topic @amoeba; I hoped to ask less about interface, but about whether this sequence makes sense from a statistical procedure, and whether this would be a meaningful interaction with the data. Jul 18 '15 at 13:54
• thanks for the pointer; I am out of my wits, obviously. The 3x3 rotation matrix should look like this, correct? Do I then add or multiply the other rotation pairs? Jul 18 '15 at 13:56
• That's right, it's how 3x3 rotation matrix looks like when the rotation happens around one of the coordinate axes (3rd one in this case). What you need to do is to multiply these matrices for all your "simple" rotations. Jul 18 '15 at 16:19