You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all. First, thanks so much to the devs of factor_analyzer. It's a fantastic and much needed package!
Is your feature request related to a problem? Please describe.
As has been pointed out, the GPA rotation methods often converge to local minima (Browne, 2001; Bernaards & Jennrich, 2005; Nguyen & Waller, 2022). As such, it's been recommended researchers initialize the GPA from many starting values when searching for a global minimum. I'm wondering if the Rotator class could be amended in order to allow initializing the GPA from different starting values.
Describe the solution you'd like
One simple solution would be for the Rotator class to accept a new argument, random_state, which defaults to None. When random_state = None, the rotation matrix is initialized with np.eye(n_cols) as is currently implemented (L326, L416, L493). When a user specifies a seed, however, the rotation matrix is initialized as a random orthogonal matrix from scipy.stats.ortho_group. That is,:
# initialize the rotation matrix_, n_cols=loadings.shapeifself.random_state==None:
rotation_matrix=np.eye(n_cols)
else:
rotation_matrix=sp.stats.ortho_group(dim=n_cols, seed=self.random_state).rvs()
Apologies in advance if the above is already possible and I've simply missed how. If the above sounds like it may be useful, I'd be happy to attempt a PR.
Hi all. First, thanks so much to the devs of
factor_analyzer
. It's a fantastic and much needed package!Is your feature request related to a problem? Please describe.
As has been pointed out, the GPA rotation methods often converge to local minima (Browne, 2001; Bernaards & Jennrich, 2005; Nguyen & Waller, 2022). As such, it's been recommended researchers initialize the GPA from many starting values when searching for a global minimum. I'm wondering if the
Rotator
class could be amended in order to allow initializing the GPA from different starting values.Describe the solution you'd like
One simple solution would be for the
Rotator
class to accept a new argument,random_state
, which defaults toNone
. Whenrandom_state = None
, the rotation matrix is initialized withnp.eye(n_cols)
as is currently implemented (L326, L416, L493). When a user specifies a seed, however, the rotation matrix is initialized as a random orthogonal matrix fromscipy.stats.ortho_group
. That is,:A solution like the above could be added to the
Rotator._oblique
,Rotator._orthogonal
,Rotator._varimax
methods (and any others that I missed).Apologies in advance if the above is already possible and I've simply missed how. If the above sounds like it may be useful, I'd be happy to attempt a PR.
All the best,
Sam (@szorowi1)
The text was updated successfully, but these errors were encountered: