R: Easy Access to Principal Component Analysis Results

principal_components_result {anomalyDetection} | R Documentation

## Easy Access to Principal Component Analysis Results

### Description

`principal_components_result` Provides easy access to principal component analysis results

### Usage

    principal_components_result(data, results = 2)

### Arguments

`data` | list output from `principal_components`
`results` | principal component analysis results to extract. Can use either results name or number (i.e. pca_loadings or 2): `pca_sdev` `pca_loadings` (default) `pca_rotated` `pca_center` `pca_scale`

### Value

Returns one of the selected results:

1. `pca_sdev`: the standard deviations of the principal components (i.e., the square roots of the eigenvalues of the correlation matrix, though the calculation is actually done with the singular values of the data matrix).

2. `pca_loadings`: the matrix of variable loadings (i.e., a matrix whose columns contain the eigenvectors).

3. `pca_rotated`: if `retx` is `TRUE` the value of the rotated data (the centred (and scaled if requested) data multiplied by the rotation matrix) is returned. Hence, `cov(x)` is the diagonal matrix `diag(sdev^2)`.

4. `pca_center`: the centering used

5. `pca_scale`: whether scaling was used

### See Also

`principal_components` for computing the principal components results

### Examples

    # An efficient means for getting principal component analysis results
    x <- matrix(rnorm(200 * 3), ncol = 10)

    principal_components(x) %>%
      principal_components_result(pca_loadings)

[Package anomalyDetection version 0.2.5 Index]