Evaluate if data are appropriate for PCA / Factor analysis

pre_factor(dataset, vars, hcor = FALSE, data_filter = "",
  envir = parent.frame())

Arguments

dataset

Dataset

vars

Variables to include in the analysis

hcor

Use polycor::hetcor to calculate the correlation matrix

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000")

envir

Environment to extract data from

Value

A list with all variables defined in the function as an object of class pre_factor

Details

See https://radiant-rstats.github.io/docs/multivariate/pre_factor.html for an example in Radiant

See also

summary.pre_factor to summarize results

plot.pre_factor to plot results

Examples

pre_factor(shopping, "v1:v6") %>% str()
#> List of 12 #> $ pre_r2 :'data.frame': 6 obs. of 1 variable: #> ..$ Rsq: num [1:6] 0.89 0.38 0.794 0.585 0.808 ... #> $ scmat : num [1:6, 1:6] 9.1 -0.24 -4.56 -1.73 5.14 ... #> ..- attr(*, "dimnames")=List of 2 #> .. ..$ : chr [1:6] "v1" "v2" "v3" "v4" ... #> .. ..$ : chr [1:6] "v1" "v2" "v3" "v4" ... #> $ pre_eigen : num [1:6] 2.664 2.15 0.473 0.433 0.217 ... #> $ pre_kmo :List of 5 #> ..$ MSA : num 0.554 #> ..$ MSAi : Named num [1:6] 0.516 0.783 0.586 0.482 0.637 ... #> .. ..- attr(*, "names")= chr [1:6] "v1" "v2" "v3" "v4" ... #> ..$ Image: num [1:6, 1:6] 1 -0.0626 -0.6846 -0.3692 0.7464 ... #> .. ..- attr(*, "dimnames")=List of 2 #> .. .. ..$ : chr [1:6] "v1" "v2" "v3" "v4" ... #> .. .. ..$ : chr [1:6] "v1" "v2" "v3" "v4" ... #> ..$ ImCov: num [1:6, 1:6] 0.1099 -0.0163 -0.1029 -0.0788 0.1083 ... #> ..$ Call : language psych::KMO(r = cmat) #> ..- attr(*, "class")= chr [1:2] "psych" "KMO" #> $ btest :List of 3 #> ..$ chisq : num 66.7 #> ..$ p.value: num 1.71e-08 #> ..$ df : num 15 #> $ cmat : num [1:6, 1:6] 1 0.0255 0.8378 -0.104 -0.8754 ... #> ..- attr(*, "dimnames")=List of 2 #> .. ..$ : chr [1:6] "v1" "v2" "v3" "v4" ... #> .. ..$ : chr [1:6] "v1" "v2" "v3" "v4" ... #> $ anyCategorical: Named logi [1:6] FALSE FALSE FALSE FALSE FALSE FALSE #> ..- attr(*, "names")= chr [1:6] "v1" "v2" "v3" "v4" ... #> $ nrObs : int 20 #> $ df_name : chr "shopping" #> $ vars : chr [1:6] "v1" "v2" "v3" "v4" ... #> $ hcor : logi FALSE #> $ data_filter : chr "" #> - attr(*, "class")= chr [1:2] "pre_factor" "list"