Skip to content

neurostatx.cli.ConfirmatoryFA

Attributes

NameDescription
appCyclopts application for the ConfirmatoryFA command-line tool.

Functions

NameDescription
ConfirmatoryFAPerform confirmatory factor analysis from loadings or a

appattributemodule attribute#

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

Cyclopts application for the ConfirmatoryFA command-line tool.

ConfirmatoryFAfunction#

def ConfirmatoryFA(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')] = './ResultsCFA/', loadings_df: Annotated[str, Parameter(show_default=False, group='Factorial Analysis parameters')] = None, model: Annotated[List[str], Parameter(show_default=False, group='Factorial Analysis parameters')] = None, threshold: Annotated[float, Parameter(--threshold, group='Factorial Analysis parameters')] = 0.4, iterations: Annotated[int, Parameter(--iterations, group='Factorial Analysis parameters')] = None, 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 confirmatory factor analysis from loadings or a lavaan-style model.

ConfirmatoryFA tests a hypothesized model of the relationships between observed variables and latent constructs. It writes factor scores, goodness of fit statistics (Chi-square, RMSEA, CFI, TLI), and an HTML report.

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.
desc_columnsintrequiredNumber of descriptive columns at the beginning of the dataset to exclude in statistics and descriptive tables.
out_folderstr'./ResultsCFA/'Path of the folder in which the results will be written. If not specified, current folder and default name will be used. Defaults to ./ResultsCFA/.
loadings_dfstrNoneFilename of the dataframe containing the loadings of the EFA analysis. Columns must be factors and rows variables. Defaults to None.
modelList[str]NoneModel specification for the CFA analysis. Must be provided within brackets (ex: –model “factor1 =~ var1 + var2 + var3” –model “factor2 =~ var4 + var5”). Defaults to None.
thresholdfloat0.4Threshold to use to determine variables to include for each factor in CFA analysis (ex: if set to 0.40, only variables with loadings higher than 0.40 will be assigned to a factor in the CFA model). Defaults to 0.40.
iterationsintNoneNumber of iterations to perform the bootstrapping of the model. Defaults to None.
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
ConfirmatoryFA --in-dataset dataset.csv --id-column ID --desc-columns 1
--out-folder ./output/ --loadings-df loadings.csv --threshold 0.40
--mean -v -f