aiorazabala / qmethod

R package to analyse Q methodology data
GNU General Public License v2.0
34 stars 18 forks source link

fix: psych::principal changes order of factors, q.mrot.do does not #263

Closed maxheld83 closed 9 years ago

maxheld83 commented 9 years ago

this is a weird bug that came up in testing (luckily).

psych::principal apparently changes the order of factors in the output upon (automatic) rotation in some cases, as per http://stackoverflow.com/questions/32349235/cannot-reproduce-varimax-rotation-from-psych-order-of-factors-is-changed

This at least causes problems in testing (when testing q.mrot.do against psych::principal), but I am afraid it might cause problems elsewhere, too.

Need to get to the bottom of this.

maxheld83 commented 9 years ago

above commit does not actually solve this problem, just avoids it in testing -> suboptimal

maxheld83 commented 9 years ago

Ok, it seems to me that we must really solve this problem at a somewhat fundamental level (see suggestions below).

Here's what happens:

Here's why that matters:

There are, in principle (principal) (haha), 2 ways out of this:

  1. Teach qmethod() (preferably psych::principal) not to reorder, at least optionally, and only accept those results as inputs to q.mrot.choose and q.mrot.do.
  2. Teach q.mrot.do to do the same kind of reordering.

I'm in favor of 1., because:

  1. rotated principal components are no longer principal components anyway, so there's not a good reason to keep them in any particular order. CrossValidated seems to agree
  2. Q methodologists are not that interested in the relative sizes of Eigenvalues to begin with, because non-random sampling, yada, yada yada ... – so we might not care
  3. reordering inside of q.mrot.do, which is called by q.mrot.choose would be a UX disaster: while manually rotating, axes would jump around (because order is changed), and plots would be 90° rotated or completely changed.
    • intelligently fixing that might be possible (by forestalling the ordering or something), but at some point, inevitably, the result would have to be reordered, and stuff would suddenly (inexplicably) look very different for the user.
    • either way, I am guessing disorientation would ensue.
  4. It's just darn simpler, smaller chance of baaaad bugs.
maxheld83 commented 9 years ago

ok, so, if no one has a better idea :smile_cat: I'll go for reverse-engineering the ordering in #273 to fix this issue, until/unless psych::principal makes it optional as per #274