# studySim: Simulation Study from Given Factor Structure Matrices and... In nFactors: Parallel Analysis and Other Non Graphical Solutions to the Cattell Scree Test

## Description

The `structureSim` function returns statistical results from simulations from predefined congeneric factor structures. The main ideas come from the methodology applied by Zwick and Velicer (1986).

## Usage

 ```1 2 3``` ```studySim(var, nFactors, pmjc, loadings, unique, N, repsim, reppar, stats = 1, quantile = 0.5, model = "components", r2limen = 0.75, all = FALSE, dir = NA, trace = TRUE) ```

## Arguments

 `var` numeric: vector of the number of variables `nFactors` numeric: vector of the number of components/factors `pmjc` numeric: vector of the number of major loadings on each component/factor `loadings` numeric: vector of the major loadings on each component/factor `unique` numeric: vector of the unique loadings on each component/factor `N` numeric: vector of the number of subjects/observations `repsim` numeric: number of replications of the matrix correlation simulation `reppar` numeric: number of replications for the parallel and permutation analysis `stats` numeric: vector of the statistics to return: mean(1), median(2), sd(3), quantile(4), min(5), max(6) `quantile` numeric: quantile for the parallel and permutation analysis `model` character: `"components"` or `"factors"` `r2limen` numeric: R2 limen value for the R2 Nelson index `all` logical: if `TRUE` computes the Bentler and Yuan index (very long computing time to consider) `dir` character: directory where to save output. Default to NA `trace` logical: if `TRUE` outputs details of the status of the simulations

## Value

 `values` Returns selected statistics about the number of components/factors to retain: mean, median, quantile, standard deviation, minimum and maximum.

## Author(s)

Gilles Raiche
Centre sur les Applications des Modeles de Reponses aux Items (CAMRI)
Universite du Quebec a Montreal
raiche.gilles@uqam.ca

## References

Raiche, G., Walls, T. A., Magis, D., Riopel, M. and Blais, J.-G. (2013). Non-graphical solutions for Cattell's scree test. Methodology, 9(1), 23-29.

Zwick, W. R. and Velicer, W. F. (1986). Comparison of five rules for determining the number of components to retain. Psychological Bulletin, 99, 432-442.

`generateStructure`, `structureSim`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30``` ```## Not run: # .................................................................... # Example inspired from Zwick and Velicer (1986) # Very long computimg time # ................................................................... # 1. Initialisation # reppar <- 30 # repsim <- 5 # quantile <- 0.50 # 2. Simulations # X <- studySim(var=36,nFactors=3, pmjc=c(6,12), loadings=c(0.5,0.8), # unique=c(0,0.2), quantile=quantile, # N=c(72,180), repsim=repsim, reppar=reppar, # stats=c(1:6)) # 3. Results (first 10 results) # print(X[1:10,1:14],2) # names(X) # 4. Study of the error done in the determination of the number # of components/factors. A positive value is associated to over # determination. # results <- X[X\$stats=="mean",] # residuals <- results[,c(11:25)] - X\$nfactors # BY <- c("nsubjects","var","loadings") # round(aggregate(residuals, by=results[BY], mean),0) ## End(Not run) ```