R: Horn's Parallel Analysis

horns_curve {anomalyDetection} | R Documentation

## Horn's Parallel Analysis

### Description

Computes the average eigenvalues produced by a Monte Carlo simulation that randomly generates a large number of `n`x`p` matrices of standard normal deviates.

### Usage

    horns_curve(data, n, p, nsim = 1000L)

### Arguments

`data` | A matrix or data frame.
`n` | Integer specifying the number of rows.
`p` | Integer specifying the number of columns.
`nsim` | Integer specifying the number of Monte Carlo simulations to run. Default is `1000`.

### Value

A vector of length `p` containing the averaged eigenvalues. The values can then be plotted or compared to the true eigenvalues from a dataset for a dimensionality reduction assessment.

### References

J. L. Horn, "A rationale and test for the number of factors in factor analysis," Psychometrika, vol. 30, no. 2, pp. 179-185, 1965.

### Examples

    # Perform Horn's Parallel analysis with matrix n x p dimensions
    x <- matrix(rnorm(200 * 10), ncol = 10)
    horns_curve(x)
    horns_curve(n = 200, p = 10)
    plot(horns_curve(x))  # scree plot

[Package anomalyDetection version 0.2.5 Index]