PA: General function to perform parallel analysis of continuous,...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/PA.R

Description

Creates an object of class PA using one of the PA functions. It performs a parallel analysis of continuous, orderd (including dichotomous/binary as a special case) or mixed type of data associated with a principal components analysis. Polychoric correlations among ordered variables, Pearson correlations among continuous variables and polyserial correlation between mixed type variables (one ordered and one continuous) are used. Whenever the use of polyserial or polychoric correlations yields a non positive definite correlation matrix, the resulting matrix is transformed into the nearest positive definite matrix by nearcor.

Usage

1
2
PA(dataMatrix, percentiles = 0.99, nReplicates = 200, type = "continuous",
   use = "complete.obs", algorithm = "polycor")

Arguments

dataMatrix

matrix or data.frame of continuous numeric variables.

percentiles

vector of percentiles to report.

nReplicates

number of simulations to produce for estimating the eigenvalues distribution under independence.

type

Data type: "continuous" if the data is continuous. "binary" if the data is dichotomous. "ordered" if the data is ordinal. "mixed" if the data is mixed rodered and continuous.

use

Missing value handling method: If "complete.obs", remove observations with any missing data; if "pairwise.complete.obs", compute each correlation using all observations with valid data for that pair of variables.

algorithm

string specifying the correlation estimation algorithm. Polychoric correlation estimation method: "polycor" for estimates using the polycor package, "polychoric" for estimates using the C++ function polychoric. Pearson correlation estimation: "pearson", only used for continuous data.

Details

This function generates an object of (S3) class "PA" by using one of the four support functions (CalculatePAContinuous, CalculatePAOrdered, CalculatePABinary, CalculatePAMixed). As noted by Presaghi & Desimoni (2011), when using the parallel analysis approach to select the number of components to retain, observed and simulated correlation matrices ought to be of the same kind. The purporse with this package is to provide a more flexible framework to work with parallel anaylisis data. For the case where all variables are ordered polytomous the C++ function polychoric or the function "polychor" from package "polycor" may be used. Pearson correlation from "cor" function is used; finally, for sets that mix variables of both types, the "polycor" package is used. Furthermore, objects of class "PA" retain the eigenvalues for simulated correlation matrices allowing the user to avoid multiple simulations for changing certain parameters such as the specific qunatile used to decide on the retained number of components; also some missing observations may be handled by the "use" parameter.

Value

An object of class "PA" with the following:

observed

data.frame containing the observed eigenvalues.

percentiles

data.frame containing the estimated percentiles of the eigenvalues distribution under independence.

simulatedEigenValues

data.frame containing the simulated eigenvalues under independence.

Note

The algorithm "polychoric" is only implemented for binary/dichotomous and ordered polytomous data. When mixed type data are used only "polycor" is currently available.

Author(s)

Carlos A. Arias carias@icfes.gov.co and Victor H. Cervantes vcervantes@icfes.gov.co

References

Horn, J. L. (1965). A rationale and test for the number of factors in factor analysis. Psychometrika, 30, 179–185.

Glorfeld, L. W. (1995). An Improvement on Horn's Parallel Analysis Methodology for Selecting the Correct Number of Factors to Retain. Educational and Psychological Measurement, 55(3), 377–393.

See Also

CalculatePAContinuous, CalculatePAOrdered, CalculatePABinary, CalculatePAMixed, print.PA, plot.PA, coef.PA, quantile.PA, CountEigen.PA, Check.PA

Examples

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# # NOT RUN
# # Run Parallel Analysis for binary data conforming to the Rasch model
# # using the polycor package
# data(simRaschData)
# binaryRaschPA <- PA(simRaschData, percentiles = c(0.95, 0.99), nReplicates = 200,
#                     type = "binary")
# print(binaryRaschPA)

# # Run Parallel Analysis for binary data conforming to the Rasch model
# # using the polychoric C++ function
data(simRaschData)
binaryRaschPA <- PA(simRaschData, percentiles = c(0.95, 0.99), nReplicates = 200,
                    type = "binary", algorithm = "polychoric")
print(binaryRaschPA)

# # NOT RUN
# # Run Parallel Analysis for binary data conforming to the 2PL model
# # using the polycor package
# data(sim2plData)
# binary2plPA <- PA(sim2plData, percentiles = c(0.95, 0.99), nReplicates = 200,
#                   type = "binary")
# print(binary2plPA)

# # Run Parallel Analysis for binary data conforming to the 2PL model
# # using the polychoric C++ function
data(sim2plData)
binary2plPA <- PA(sim2plData, percentiles = c(0.95, 0.99), nReplicates = 200,
                  type = "binary", algorithm = "polychoric")
print(binary2plPA)

# # NOT RUN
# # Run Parallel analysis for ordered polytomous data using the polycor package
# data(Science)
# Science[, ] <- lapply(Science, as.ordered)
# orderedPA <- PA(Science, percentiles = c(0.90, 0.99), nReplicates = 200,
#                 type = "ordered")
# print(orderedPA)

# # Run Parallel analysis for ordered polytomous data using the polychoric C++ function
data(Science)
Science[, ] <- lapply(Science, as.ordered)
orderedPA   <- PA(Science, percentiles = c(0.90, 0.99), nReplicates = 200,
                  type = "ordered", algorithm = "polychoric")
print(orderedPA)

# # NOT RUN
# # Run Parallel analysis of mixed ordered and continuous data
# data(mixedScience)
# mixedPA <- PA(mixedScience, percentiles = c(0.90, 0.99), nReplicates = 200,
#               type = "mixed")
# print(mixedPA)

# # Run Parallel analyis of numeric data (Iris)
data(iris)
continuousPA <- PA(iris[, -5], percentiles = c(0.90, 0.99), nReplicates = 200,
                   type = "continuous", algorithm = "pearson")
print(continuousPA)

pcaPA documentation built on May 29, 2017, 6:53 p.m.

Related to PA in pcaPA...