Learn R Programming

nzilbb.vowels (version 0.3.1)

permutation_test: Run permutation test on PCA analysis.

Description

[Superseded] Permute data fed to PCA a given number of times, collecting the number of significant pairwise correlations in the permuted data and the variances explained for a given number of PCs.

Usage

permutation_test(
  pca_data,
  pc_n = 5,
  n = 100,
  scale = TRUE,
  cor.method = "pearson"
)

Value

object of class permutation_test

  • $permuted_variances n x pc_no matrix of variances explained by first pc_no PCs in n permutations of original data.

  • $permuted_correlations list of length n of significant pairwise correlations in n permutations of the data (<= 0.05).

  • $actual_variances pc_n x 2 tibble of variances explained by first pc_n PCs with original data.

  • $actual_correlations the number of significant pairwise correlations (<= 0.05) in the original data.

Arguments

pca_data

data fed to the prcomp function. Remove non-continuous variables.

pc_n

the number of PCs to collect variance explained from.

n

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

scale

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

cor.method

method to use for correlations (default = "pearson"). Alternative is "spearman".

Details

This function is now superseded. Use correlation_test() for pairwise correlations and pca_test() for variance explained and loadings.

Examples

Run this code
permutation_test(
  onze_intercepts |> dplyr::select(-speaker),
  pc_n = 5,
  n = 10,
  scale = TRUE,
  cor.method = 'pearson'
 )

Run the code above in your browser using DataLab