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 similarity_matrix
,
and bootstrapped iterations of similarity_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(
similarity_matrix,
n_boots = 50,
n_perms = 50,
test_dimensions = 5,
principal = TRUE,
mds_type = "ordinal",
spline_degree = 2,
spline_int_knots = 2
)
Arguments
- similarity_matrix
Square matrix of speaker similarity 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
smacof::smacofSym()
(default: 'ordinal')- spline_degree
How many spline degrees when
type
is 'mspline' (default: 2)- spline_int_knots
How many internal knots when
type
is 'mspline' (default: 2)
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(
sim_matrix,
n_boots = 5,
n_perms = 5,
test_dimensions = 3,
mds_type = 'interval'
)
#> $stress_reduction
#> # A tibble: 33 × 6
#> source dims stress_dist cumulative lag_stress diff
#> <chr> <int> <dbl> <dbl> <dbl> <dbl>
#> 1 permuted 1 0.535 1 1 0.465
#> 2 permuted 1 0.531 2 1 0.469
#> 3 permuted 1 0.531 3 1 0.469
#> 4 permuted 1 0.531 4 1 0.469
#> 5 permuted 1 0.526 5 1 0.474
#> 6 permuted 2 0.357 1 0.535 0.178
#> 7 permuted 2 0.352 2 0.531 0.179
#> 8 permuted 2 0.350 3 0.531 0.180
#> 9 permuted 2 0.356 4 0.531 0.175
#> 10 permuted 2 0.353 5 0.526 0.173
#> # ℹ 23 more rows
#>
#> $n_boots
#> [1] 5
#>
#> $n_perms
#> [1] 5
#>
#> $mds_type
#> [1] "interval"
#>
#> $principal
#> [1] TRUE
#>
#> attr(,"class")
#> [1] "mds_test_results"