# factor_analysis: Factor Analysis choosing number of factors automatically In neale-eldash/neale: FUNCTIONS I HAVE DEVELOPED FOR PERSONAL USE

## Description

This function runs as Factor Analysis. The first step is to calculate the number of factors automatically. Once the number of factor is choosen, the Factor Analysis is run, and both the estimated factor variables and the loadings are calculated. Missing values aren't aloud. Details of the analysis for each step are:

• # of Factors: Calculates the number of eigenvalues in the correlation matrix that are larger then 1. The idea is that if the variance of a standardized variable is 1, then a factor should only be maintained if it's variance is at least one. See more details in `eigen`.

• Factor Analysis: The default options are `rotation='varimax'` and `scores='regression'`. See more details in `factanal`.

## Usage

 ```1 2``` ```factor_analysis(df = NULL, n.fat = NULL, name = "fator", sep = ".", rotation = "varimax", scores = "regression", cut = 0.2) ```

## Arguments

 `df` A dataframe containing the variables to be used in the analysis. `n.fat` A number with the number of factors to use. if NULL then the number of factors is calculated automatically. `name` A string with the name of the factor variables that will be created. `sep` A string with the character to be used separating name of the factor from the number of the factor `rotation` A string identifying the type of rotation to be performed. `scores` A string identifying the type of scores to be extracted. `cut` A number indicating the minimum size of factor loadings that should be kept. Loadings smaller then cut will be dropped.

## Value

A list with two components:

• factors(dataframe): with the variables with the scores extrated from the factor analysis.

 `1` ```df_factan <- factor_analysis(df=df,cut=0.2) ```