# Exploratory Factor Analysis Workflow

This vignette shows a compact screening-to-EFA workflow with the example ordinal dataset included in `PsychoMatic`.

    library(PsychoMatic)
    data(psychomatic_ordinal)

## Item Screening

    screen_items(psychomatic_ordinal)
    #>   item   n missing missing_pct  mean    sd min max skewness kurtosis
    #> 1 ord1 120       0           0 3.025 1.475   1   5    0.020   -1.449
    #> 2 ord2 120       0           0 3.083 1.412   1   5   -0.164   -1.350
    #> 3 ord3 120       0           0 2.975 1.417   1   5   -0.009   -1.343
    #> 4 ord4 120       0           0 3.017 1.444   1   5   -0.045   -1.394
    #> 5 ord5 120       0           0 3.042 1.417   1   5   -0.003   -1.368
    #> 6 ord6 120       0           0 3.008 1.369   1   5   -0.054   -1.274
    #>   n_categories zero_variance floor_pct ceiling_pct floor_flag ceiling_flag
    #> 1            5         FALSE     0.200       0.233      FALSE        FALSE
    #> 2            5         FALSE     0.192       0.183      FALSE        FALSE
    #> 3            5         FALSE     0.208       0.183      FALSE        FALSE
    #> 4            5         FALSE     0.208       0.200      FALSE        FALSE
    #> 5            5         FALSE     0.175       0.208      FALSE        FALSE
    #> 6            5         FALSE     0.183       0.167      FALSE        FALSE
    #>   item_rest_correlation probable_reverse
    #> 1                 0.788            FALSE
    #> 2                 0.834            FALSE
    #> 3                 0.826            FALSE
    #> 4                 0.835            FALSE
    #> 5                 0.859            FALSE
    #> 6                 0.809            FALSE

## Reverse Scoring And Scale Scores

If an item is theoretically reverse keyed, reverse it before computing scale scores.

    scored <- score_scale(
      psychomatic_ordinal,
      items = names(psychomatic_ordinal),
      method = "mean",
      min_valid = 0.80
    )
    scored$reliability
    #>   scale n_items min_valid     alpha mean_score sd_score n_scored
    #> 1 total       6         5 0.9419791      3.025 1.252383      120

## Exploratory Factor Analysis

The full automated EFA routine can be run as follows. It is not evaluated during CRAN vignette checks because parallel analysis and polychoric correlations may take longer on constrained machines.

    efa_result <- efa_auto(
      psychomatic_ordinal,
      rotation = "oblique",
      max_iter = 3,
      verbose = FALSE,
      language = "eng"
    )
    summary(efa_result)