Skip to contents

After running rotate_mfa_model or any rotation, each factor's sign can be arbitrary. This function enforces a rule such as: "The variable with the largest absolute loading in each factor must be positive." Then, if that factor's column is flipped, we also flip the corresponding column in the factor scores, to keep the model consistent.

Usage

align_factor_signs_mfa(mfa_fit, method = c("max_abs"), cluster_ids = NULL)

Arguments

mfa_fit

A fitted MFA model (with Lambda[[k]], factor_scores[[i]], z, etc.).

method

A string specifying how to choose the sign. Currently only "max_abs" is implemented, which flips the column if the variable with the largest absolute loading is negative.

cluster_ids

Which clusters to process. Defaults to all.

Value

The same mfa_fit object, but with possibly flipped signs in Lambda columns and factor_scores columns.

Details

- For each cluster k, we loop over each factor (column). We find the row index i_max that has the largest absolute loading. If Lambda[k][i_max, factor] < 0, we multiply that entire column by -1. - If factor_scores is present, we also multiply the corresponding column in each subject's factor score by -1 to maintain consistency. - This doesn't change the model fit or BIC, just the sign convention.