简体   繁体   中英

Factor in R according to factor analysis

I am intrested in creating a factor out of 4 variables that were suggested as being one factor in my Factor Analysis. Now i am trying to create exactly this factor to enter in my analysis, however as.factor(x) does not combine my dummy variables.

We can use interaction

with(df1, interaction(col1, col2, col3, col4, drop = TRUE))

Are you looking to organize multiple variables into one factor that you can then run a Confirmatory Factor Analysis on? If so, the following example shows how to specify which items in your data set that you want to load onto said factor. Specifying the factor loadings requires the psych package in R and creating the factor model requires the sem() function from the sem package.

theoretical_factor_structure <- "
AGREEABLE: A1, A2, A3, A4, A5"

factors_for_CFA <- cfa(text = theoretical_factor_structure, 
reference.indicators = FALSE)

    CFA_model <- sem(factors_for_CFA, data = CFA_data_split) 

Apologies if this was not the question you were asking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM