pca_test {nzilbb.vowels}R Documentation

PCA with confidence intervals and null distributions

Description

Permute and bootstrap data fed to PCA n times. Bootstrapped data is used to estimate confidence bands for variance explained by each PC and for each loading. Squared loadings are multiplied by the squared eigenvalue of the relevant PC. This ranks the loadings of PCs which explain a lot of variance higher than those from PCs which explain less. This approach to PCA testing follows Carmago (2022) and Vieria (2012). This approach differs from Carmago's PCAtest package by separating data generation and plotting.

Usage

pca_test(
  pca_data,
  n = 100,
  scale = TRUE,
  variance_confint = 0.95,
  loadings_confint = 0.9
)

Arguments

pca_data

data fed to the prcomp function.

n

the number of times to permute and bootstrap that data. Warning: high values will take a long time to compute.

scale

whether the PCA variables should be scaled (default: TRUE).

variance_confint

size of confidence intervals for variance explained (default: 0.95).

loadings_confint

size of confidence intervals for index loadings (default: 0.9).

Details

Default confidence bands on variance explained at 0.95 (i.e. alpha of 0.05). In line with Vieria (2012), the default confidence bands on the index loadings are at 0.9.

See plot_loadings() and plot_variance_explained() for useful plotting functions.

Value

object of class pca_test_results, containing:

References

Camargo, Arley (2022), PCAtest: testing the statistical significance of Principal Component Analysis in R. PeerJ 10. e12967. doi:10.7717/peerj.12967

Vieira, Vasco (2012): Permutation tests to estimate significances on Principal Components Analysis. Computational Ecology and Software 2. 103–123.

Examples

onze_pca <- pca_test(
  onze_intercepts |> dplyr::select(-speaker),
  n = 10,
  scale = TRUE
)
summary(onze_pca)

[Package nzilbb.vowels version 0.4.1 Index]