mds_test {nzilbb.vowels} | R Documentation |
Test optimal number of MDS dimensions.
Description
Generate bootstrapped confidence intervals and permutation based null
distribution for MDS analysis. Output shows how much stress is reduced by
adding an additional dimension to the MDS analysis of
dissimilarity_matrix
,
and bootstrapped iterations of dissimilarity_matrix
,
compared with the stress reduction expected from a matrix with no meaningful
structure. This function is inspired by pca_test()
, but is less connected
with statistical literature than that function. We currently reject
additional dimensions is they reduce less stress than we would expect by
chance. That is, when the distribution from the boostrapped analyses sits
notably lower than the permuted distribution when plotted by plot_mds_test()
Usage
mds_test(
dissimilarity_matrix,
n_boots = 50,
n_perms = 50,
test_dimensions = 5,
principal = TRUE,
mds_type = "ordinal",
spline_degree = 2,
spline_int_knots = 2,
...
)
Arguments
dissimilarity_matrix |
Square matrix of dissimilarity scores. |
n_boots |
Number of bootstrapping iterations (default: 25). |
n_perms |
Number of permutations (default: 25). |
test_dimensions |
Number of MDS dimensions to test for stress reduction (default: 5). |
principal |
Whether to apply principal axis transform to MDS (default: TRUE) |
mds_type |
What kind of MDS to apply, see |
spline_degree |
How many spline degrees when |
spline_int_knots |
How many internal knots when |
... |
Arguments passed to |
Value
object of class mds_test_results
, containing:
-
$stress_reduction
a tibble containing -
$n_boots
Number of bootstrapping iterations. -
$n_perms
Number of permutation iterations -
$mds_type
Type of MDS analysis (type
argument passed tosmacof::smacofSym()
) -
$principal
Whether principal axis transformation is applied (passed tosmacof::smacofSym()
)
Examples
# Apply interval MDS to `sim_matrix`, with 5 permutations and bootstraps
# testing up to 3 dimensions. In real usage, increase `n_boots` and `n_perms`
# to at least 50.
mds_test(
smacof::sim2diss(sim_matrix, method="reverse"),
n_boots = 5,
n_perms = 5,
test_dimensions = 3,
mds_type = 'interval'
)