Skip to content

neurostatx.cli.ExploratoryFA

Attributes

NameDescription
appCyclopts application for the ExploratoryFA command-line tool.

Functions

NameDescription
ExploratoryFAPerform exploratory factor analysis with Horn's parallel analysis.

appattributemodule attribute#

app = App(default_parameter=Parameter(negative=()))

Cyclopts application for the ExploratoryFA command-line tool.

ExploratoryFAfunction#

def ExploratoryFA(in_dataset: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], id_column: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], desc_columns: Annotated[int, Parameter(show_default=False, group='Essential Files Options')], out_folder: Annotated[str, Parameter(group='Essential Files Options')] = './ResultsEFA/', rotation: Annotated[RotationTypes, Parameter(group='Factorial Analysis parameters')] = RotationTypes.promax, method: Annotated[MethodTypes, Parameter(group='Factorial Analysis parameters')] = MethodTypes.minres, nb_factors: Annotated[int, Parameter(--nb_factors, group='Factorial Analysis parameters')] = None, train_dataset_size: Annotated[float, Parameter(--train_dataset_size, group='Factorial Analysis parameters')] = 0.5, random_state: Annotated[int, Parameter(--random_state, group='Factorial Analysis parameters')] = 1234, verbose: Annotated[bool, Parameter(-v, --verbose, group='Optional parameters')] = False, save_parameters: Annotated[bool, Parameter(-s, --save_parameters, group='Optional parameters')] = False, overwrite: Annotated[bool, Parameter(-f, --overwrite, group='Optional parameters')] = False)

Perform exploratory factor analysis with Horn’s parallel analysis.

ExploratoryFA fits an EFA model using the provided rotation and method. When only an EFA is requested, Horn’s parallel analysis determines the optimal number of factors to extract. The script can also split the data into a training set for EFA and a test set for later ConfirmatoryFA. It writes the EFA model, loadings, communalities, and the transformed dataset.

Parameters

NameTypeDefaultDescription
in_datasetstrrequiredInput dataset to use in the factorial analysis.
id_columnstrrequiredName of the column containing the subject’s ID tag. Required for proper handling of IDs and merging multiple datasets.
desc_columnsintrequiredNumber of descriptive columns at the beginning of the dataset to exclude in statistics and descriptive tables.
out_folderstr'./ResultsEFA/'Path of the folder in which the results will be written. If not specified, current folder and default name will be used. Defaults to ./ResultsEFA/.
rotationRotationTypesRotationTypes.promaxSelect the type of rotation to apply on your data. Defaults to promax.
methodMethodTypesMethodTypes.minresSelect the method for fitting the data. Defaults to minres.
nb_factorsintNoneSpecify the number of factors to extract from the data. If not specified, the script will use Horn’s parallel analysis to determine the optimal number of factors. Defaults to None.
train_dataset_sizefloat0.5Specify the proportion of the input dataset to use as training dataset in the EFA (value from 0 to 1). Defaults to 0.5.
random_stateint1234Random seed for reproducibility. Defaults to 1234.
verboseboolFalseIf true, produce verbose output. Defaults to False.
save_parametersboolFalseIf true, save the parameters used in the analysis in a text file. Defaults to False.
overwriteboolFalseIf true, force overwriting of existing output files. Defaults to False.

Examples

Terminal window
ExploratoryFA --in-dataset df --id-column IDs --out-folder results_FA/
--rotation promax --method ml --train_dataset_size 0.5 -v -f -s