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:
- User chooses a component pair from the combinations of factors one of columns from
combs <- combn(x = ncol(loa.orig), m = 2, simplify = TRUE)
- User enters an angle in degrees to rotate the given factor pair, say
f1
vsf2
, say5°
clockwise. f1
andf2
are rotated5°
clockwise- all plots involving either
f1
orf2
are updated, because they all change. (correct?) - User enters another angle to try out, say
10°
, still onf1
andf2
- repeat steps
3
,4
,5
as long as the user wants - user indicates that she is done with
f1
andf2
. - the rotated loadings matrix is saved to, say
loa.rot
- return to step
1
, now all rotations, say betweenf2
andf3
are done on the rotatedloa.rot
from the past loop. - repeat steps
1-9
. - 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.