Skip to contents

Likelihood-ratio test of unidimensionality against an a priori specified multidimensional alternative, generalised to polytomous Rasch / partial credit models (Christensen, Bjorner, Kreiner, & Petersen, 2002). The p-value is obtained by parametric-bootstrap (Monte Carlo) sampling under the unidimensional null, following Christensen & Kreiner (2007), because the asymptotic chi-square approximation is biased toward conservatism for realistic sample sizes – especially with polytomous items, where the degrees of freedom can be very large.

Usage

RMdimMartinLof(
  data,
  partition,
  iterations = 1000L,
  stopping = c("none", "sequential"),
  h = 50L,
  alpha = 0.05,
  parallel = TRUE,
  n_cores = NULL,
  verbose = FALSE,
  seed = NULL
)

Arguments

data

A data.frame or matrix of item responses (0-based, non-negative integers). Rows with any NA are dropped.

partition

The hypothesised partition of items into subscales. One of:

  • a list of column-name or column-index vectors, e.g. list(c("I1","I2","I3"), c("I4","I5","I6"));

  • a vector of length ncol(data) indicating each item's subscale (factor, character, or integer), e.g. c(1,1,1,2,2,2). Each subscale must contain at least two items. Subscales must not overlap; items not assigned to any subscale are dropped with a warning.

iterations

Integer. Maximum number of Monte Carlo iterations (default 1000).

stopping

Character. "none" (default) runs all iterations. "sequential" uses Besag & Clifford's (1991) sequential rule: stop as soon as h simulated statistics have exceeded the observed value. The sequential strategy substantially reduces compute time when H0 holds but cannot be parallelised.

h

Integer. Sequential-stopping count threshold (default 50). Ignored when stopping = "none".

alpha

Numeric in (0, 1). Nominal significance level used only for the rejected flag in the result; default 0.05.

parallel

Logical. Use parallel processing via mirai (default TRUE). Ignored when stopping = "sequential".

n_cores

Integer or NULL. Number of parallel workers. When NULL, getOption("mc.cores") is checked first; if neither is set, falls back to sequential with a warning.

verbose

Logical. Show a progress bar (default FALSE).

seed

Integer or NULL. Random seed for reproducibility. Items are processed internally in a fixed (alphabetical) order, so the same seed reproduces the same p-value regardless of how the data's columns are arranged.

Value

A list with components:

T_obs

Observed Martin-Löf likelihood-ratio statistic.

p_value

Monte Carlo p-value with (n_exceed + 1) / (n + 1) correction. The attainable p-values are k / (n + 1) for k = 1, ..., n + 1, so the p-value's resolution is limited by the number of iterations: with 100 iterations the smallest attainable value is 1/101 = 0.0099. A reported p-value equal to the floor (see p_value_floor) means no simulated statistic reached the observed one and should be read as "p < floor" – the true p-value may be much smaller; increase iterations for finer resolution.

p_value_floor

The smallest attainable p-value, 1 / (actual_iterations + 1).

actual_iterations

Number of successful MC iterations completed.

rejected

Logical: is p_value < alpha?

partition

Normalised partition (list of integer indices).

n_subscales

Number of subscales.

is_polytomous

Whether a PCM was fitted.

sample_n

Number of complete cases analysed.

n_items

Number of items.

stopping

The stopping strategy used.

h

The sequential-stopping count, or NA for stopping = "none".

T_rep

Numeric vector of successful MC test statistics.

wle_scores

data.frame with one row per person and one column per subscale (subscale_1_wle, ..., subscale_D_wle), giving Warm's Weighted Likelihood Estimate of theta from a CML fit on each subscale alone. Persons whose subscore equals the minimum or maximum on a subscale produce non-finite WLEs (Inf / -Inf) and are excluded from wle_correlation pairwise.

wle_correlation

data.frame of pairwise Pearson correlations between subscale WLEs, with columns subscale_a, subscale_b, r, ci_lower, ci_upper (95% CI from stats::cor.test), p_value, and n (number of persons with finite WLEs on both subscales). One row per pair; for D = 2, a single row. Useful as an effect-size companion to p_value – a rejected test with r near 1 indicates a small effect; r clearly below 1 indicates substantive multidimensionality.

Details

This is not a routine screening tool. The test requires an a priori partition of items into subscales; using it post-hoc on, e.g., the partition suggested by RMdimResidualPCA()'s PC1 sign would inflate the Type-I error rate. Both source papers state this explicitly.

Test statistic. With items partitioned into D subscales, total score \(t\) and subscores \((t_1, \ldots, t_D)\) (Christensen et al. 2002, eq. 22): $$T = 2\Bigl[\sum_{t_1, \ldots, t_D} n_{t_1, \ldots, t_D}\log(n_{t_1, \ldots, t_D}/N) - \sum_t n_t\log(n_t/N) - \ell_C(\hat{\epsilon}) + \sum_d \ell_C(\hat{\epsilon}^{(d)})\Bigr]$$ where \(\ell_C\) is the conditional log-likelihood and the \(\hat{\epsilon}^{(d)}\) are CML estimates on the d-th subscale alone. CML fits use psychotools::raschmodel() (RM) or psychotools::pcmodel() (PCM) for speed.

Monte Carlo sampling under H0. Following Christensen & Kreiner (2007): (a) sample N total scores from the empirical score distribution \(n_t/N\); (b) for each sampled score, sample an item-response vector from the conditional distribution \(p(x \mid t, \hat{\epsilon})\) given by eq. 4 of the paper. For dichotomous data the fast algorithm of Christensen & Kreiner (2007, p. 23) is used (sample without replacement weighted by item easinesses). For polytomous data the recursive \(\gamma\)-function approach is used, with each item's response sampled conditional on the remaining items' joint score distribution (computed via psychotools::elementary_symmetric_functions()).

Iterations that fail (e.g., simulated dataset has an empty category for an item) are silently dropped.

Item parameters are estimated once on the observed data and held fixed across MC iterations. Christensen & Kreiner (2007) use the extended likelihood function (Tjur, 1982) with the empirical score distribution as a non-parametric estimate of the latent distribution, so no distributional assumption about \(\theta\) is needed.

References

Christensen, K. B., Bjorner, J. B., Kreiner, S., & Petersen, J. H. (2002). Testing unidimensionality in polytomous Rasch models. Psychometrika, 67(4), 563-574. doi:10.1007/BF02295132

Christensen, K. B., & Kreiner, S. (2007). A Monte Carlo approach to unidimensionality testing in polytomous Rasch models. Applied Psychological Measurement, 31(1), 20-30. doi:10.1177/0146621605286204

Besag, J., & Clifford, P. (1991). Sequential Monte Carlo p-values. Biometrika, 78(2), 301-304. doi:10.1093/biomet/78.2.301

Examples

# \donttest{
set.seed(1)
# Build 2-dimensional polytomous data: 4 items per subscale, 5 categories
n     <- 400
theta1 <- rnorm(n)
theta2 <- 0.6 * theta1 + sqrt(1 - 0.6^2) * rnorm(n)
make_pcm <- function(theta, n_items, taus) {
  sapply(seq_len(n_items), function(j) {
    # ... toy simulation here
    sample(0:4, n, replace = TRUE)
  })
}
dat <- cbind(make_pcm(theta1, 4, NULL), make_pcm(theta2, 4, NULL))
colnames(dat) <- paste0("I", 1:8)

# Few iterations for a fast example; use 1000+ in real analyses
RMdimMartinLof(dat,
            partition = list(c("I1","I2","I3","I4"),
                             c("I5","I6","I7","I8")),
            iterations = 100, parallel = FALSE, seed = 1)
#> $T_obs
#> [1] 192.632
#> 
#> $p_value
#> [1] 0.5940594
#> 
#> $p_value_floor
#> [1] 0.00990099
#> 
#> $actual_iterations
#> [1] 100
#> 
#> $rejected
#> [1] FALSE
#> 
#> $partition
#> $partition[[1]]
#> [1] 1 2 3 4
#> 
#> $partition[[2]]
#> [1] 5 6 7 8
#> 
#> 
#> $n_subscales
#> [1] 2
#> 
#> $is_polytomous
#> [1] TRUE
#> 
#> $sample_n
#> [1] 400
#> 
#> $n_items
#> [1] 8
#> 
#> $stopping
#> [1] "none"
#> 
#> $h
#> [1] NA
#> 
#> $T_rep
#>   [1] 217.3739 156.9169 178.9840 211.2337 190.9902 197.9099 200.7671 175.4362
#>   [9] 155.5236 213.5078 209.8393 212.2892 224.7373 200.0692 213.2293 218.6514
#>  [17] 215.9354 185.6733 191.6138 184.7622 196.8899 193.1802 201.9903 196.4503
#>  [25] 186.3135 185.5979 210.9303 178.3912 176.9220 198.5879 169.1423 197.1674
#>  [33] 173.3412 191.4246 195.2852 226.3838 189.8889 182.4467 182.4824 204.9755
#>  [41] 210.8322 205.7216 183.0040 169.7485 180.3166 206.8898 173.9285 189.8289
#>  [49] 200.0002 223.2624 182.1958 231.5607 193.5054 193.7613 186.0160 192.5819
#>  [57] 167.7840 182.1707 163.5399 166.4012 214.3525 184.4794 201.9769 206.4572
#>  [65] 166.9049 185.7820 196.9688 208.9551 226.8527 194.6176 191.9582 213.7848
#>  [73] 202.4612 197.0988 182.6484 166.8774 227.3283 216.5728 211.3303 194.3861
#>  [81] 190.0304 205.6361 196.1770 218.5077 176.4973 211.8179 202.2630 202.4776
#>  [89] 206.8426 210.3141 198.0656 173.7472 192.8587 205.2612 201.4721 180.2346
#>  [97] 198.2777 188.6162 224.2046 204.4681
#> 
#> $wle_scores
#>     subscale_1_wle subscale_2_wle
#> 1       0.01719779   -0.008686632
#> 2       0.84330449   -0.233715303
#> 3       0.01719779   -0.233715303
#> 4      -0.46132203   -1.979433785
#> 5       0.48625873    0.217552164
#> 6       0.12496572   -0.008686632
#> 7      -0.20344194   -0.008686632
#> 8       0.12496572    0.341482037
#> 9       0.84330449   -0.355949378
#> 10      0.48625873    0.341482037
#> 11     -0.46132203   -0.233715303
#> 12     -0.46132203    0.341482037
#> 13     -0.46132203   -0.008686632
#> 14     -0.09103387   -0.119463378
#> 15      0.01719779    0.102381758
#> 16      0.01719779    2.059504266
#> 17      0.01719779   -0.355949378
#> 18      0.35429558   -0.492620587
#> 19      0.01719779    0.341482037
#> 20      0.01719779   -0.355949378
#> 21     -0.20344194   -0.233715303
#> 22      0.35429558    0.217552164
#> 23      0.48625873   -0.119463378
#> 24     -0.20344194    0.341482037
#> 25     -0.20344194    0.217552164
#> 26     -0.46132203    0.341482037
#> 27      0.23589905    0.102381758
#> 28      0.35429558   -0.355949378
#> 29      0.12496572    0.217552164
#> 30     -0.46132203   -0.119463378
#> 31      0.64212441   -1.188316539
#> 32      0.01719779    0.341482037
#> 33     -0.20344194    0.217552164
#> 34      0.12496572    0.217552164
#> 35      0.12496572   -0.008686632
#> 36     -0.09103387    0.341482037
#> 37      0.48625873   -0.355949378
#> 38      0.01719779    0.480962199
#> 39     -0.20344194   -0.008686632
#> 40     -0.32461579    0.480962199
#> 41      0.12496572   -0.008686632
#> 42     -0.09103387   -0.119463378
#> 43      0.35429558   -0.233715303
#> 44     -0.09103387   -0.355949378
#> 45     -0.09103387   -0.008686632
#> 46     -0.20344194    0.102381758
#> 47      0.48625873    0.480962199
#> 48     -0.20344194   -0.654732979
#> 49      0.48625873    0.341482037
#> 50      0.64212441    0.217552164
#> 51      0.23589905   -0.233715303
#> 52      0.84330449    0.647745574
#> 53      0.23589905   -0.119463378
#> 54      0.23589905   -0.119463378
#> 55     -0.32461579    0.341482037
#> 56      0.35429558    0.341482037
#> 57      0.01719779    0.647745574
#> 58      0.48625873    0.102381758
#> 59     -0.09103387   -0.008686632
#> 60      0.35429558   -0.233715303
#> 61     -0.32461579   -0.008686632
#> 62     -0.32461579   -0.233715303
#> 63      0.23589905   -0.119463378
#> 64      0.35429558   -0.008686632
#> 65     -0.32461579    0.341482037
#> 66     -0.20344194    0.217552164
#> 67     -0.46132203    0.217552164
#> 68     -0.20344194   -0.492620587
#> 69     -0.20344194   -0.233715303
#> 70     -0.20344194    0.102381758
#> 71     -0.84239770    0.341482037
#> 72     -0.46132203   -0.008686632
#> 73      0.23589905    0.102381758
#> 74      0.12496572    0.341482037
#> 75     -0.09103387   -0.008686632
#> 76      0.23589905   -0.008686632
#> 77     -0.32461579   -0.492620587
#> 78     -0.46132203   -0.355949378
#> 79      0.23589905   -0.355949378
#> 80      0.12496572    0.102381758
#> 81     -0.09103387   -0.233715303
#> 82      0.64212441   -0.355949378
#> 83     -0.20344194   -0.008686632
#> 84     -0.32461579   -0.355949378
#> 85      0.01719779   -0.233715303
#> 86      0.48625873   -0.119463378
#> 87      0.12496572   -0.355949378
#> 88      0.01719779    0.217552164
#> 89      0.01719779    0.102381758
#> 90      0.23589905   -0.119463378
#> 91      0.48625873    0.480962199
#> 92     -0.09103387    0.102381758
#> 93      0.01719779   -0.233715303
#> 94     -0.32461579   -0.119463378
#> 95      0.01719779    0.102381758
#> 96      0.48625873   -0.008686632
#> 97     -0.32461579    0.102381758
#> 98     -0.09103387   -0.119463378
#> 99      0.01719779   -0.233715303
#> 100    -0.09103387    0.480962199
#> 101    -0.46132203   -0.492620587
#> 102    -0.20344194   -0.119463378
#> 103     0.23589905   -0.008686632
#> 104    -0.20344194    0.480962199
#> 105    -0.20344194    0.102381758
#> 106     0.23589905   -0.355949378
#> 107     0.23589905   -0.492620587
#> 108    -0.20344194   -0.492620587
#> 109     0.48625873   -0.008686632
#> 110     0.01719779   -0.492620587
#> 111     0.64212441   -0.233715303
#> 112     0.35429558    0.217552164
#> 113    -0.09103387   -0.233715303
#> 114     0.23589905    0.102381758
#> 115    -0.09103387    0.647745574
#> 116     0.01719779    0.480962199
#> 117     0.64212441   -0.008686632
#> 118     0.23589905    0.102381758
#> 119     0.64212441   -0.355949378
#> 120     0.48625873    0.217552164
#> 121    -0.09103387   -0.492620587
#> 122     0.23589905   -0.233715303
#> 123     0.48625873    0.341482037
#> 124     0.35429558   -0.233715303
#> 125     0.01719779    0.647745574
#> 126     0.35429558    0.480962199
#> 127     0.01719779   -0.355949378
#> 128    -0.84239770   -0.492620587
#> 129     0.23589905   -0.008686632
#> 130     0.23589905   -0.119463378
#> 131    -0.46132203   -0.492620587
#> 132     0.12496572    0.341482037
#> 133     0.23589905   -0.233715303
#> 134    -0.09103387   -0.492620587
#> 135     0.23589905   -0.492620587
#> 136    -0.32461579   -0.654732979
#> 137    -0.09103387   -0.233715303
#> 138     0.12496572   -0.233715303
#> 139     0.12496572    0.217552164
#> 140     0.12496572   -0.492620587
#> 141    -0.46132203   -0.008686632
#> 142    -0.32461579    0.217552164
#> 143     0.01719779    0.217552164
#> 144     0.12496572    0.480962199
#> 145    -0.20344194    0.341482037
#> 146     0.12496572   -1.188316539
#> 147    -0.46132203   -0.355949378
#> 148    -0.09103387    0.341482037
#> 149     0.23589905    0.217552164
#> 150    -0.09103387    0.480962199
#> 151    -0.32461579   -0.865189748
#> 152     0.35429558   -0.008686632
#> 153     0.23589905   -0.008686632
#> 154     0.23589905    0.217552164
#> 155     0.12496572   -0.233715303
#> 156    -0.09103387    0.217552164
#> 157     0.48625873   -0.008686632
#> 158     0.23589905   -0.492620587
#> 159     0.01719779   -0.119463378
#> 160    -0.84239770   -0.233715303
#> 161    -0.20344194   -0.492620587
#> 162     0.35429558    0.102381758
#> 163     0.12496572   -1.188316539
#> 164    -0.09103387    0.341482037
#> 165    -0.46132203   -0.355949378
#> 166    -0.09103387    0.341482037
#> 167    -0.20344194    2.059504266
#> 168    -0.46132203    0.217552164
#> 169     0.12496572    0.217552164
#> 170     0.12496572    0.217552164
#> 171     0.01719779    0.217552164
#> 172     0.23589905    0.102381758
#> 173     0.35429558   -1.188316539
#> 174     0.35429558    0.217552164
#> 175     0.01719779   -0.355949378
#> 176    -0.09103387    0.102381758
#> 177    -0.62542083    0.102381758
#> 178     0.12496572   -0.008686632
#> 179     0.23589905    0.341482037
#> 180    -0.09103387    0.341482037
#> 181    -0.62542083   -0.008686632
#> 182     0.64212441    0.866646436
#> 183     0.84330449    0.480962199
#> 184     0.12496572   -0.008686632
#> 185    -0.32461579    0.217552164
#> 186    -0.09103387   -0.355949378
#> 187     0.12496572    2.059504266
#> 188     0.35429558   -0.865189748
#> 189     0.01719779   -0.355949378
#> 190     0.12496572   -0.355949378
#> 191     0.01719779   -0.119463378
#> 192    -0.09103387    0.341482037
#> 193     0.01719779   -0.865189748
#> 194    -1.18699295    0.341482037
#> 195     0.12496572    0.480962199
#> 196     0.84330449   -0.355949378
#> 197     0.48625873    0.102381758
#> 198     0.48625873   -0.233715303
#> 199    -0.32461579   -0.355949378
#> 200     0.35429558    0.102381758
#> 201     0.01719779   -0.008686632
#> 202     1.14993888    0.341482037
#> 203     0.12496572   -0.119463378
#> 204    -0.20344194    0.102381758
#> 205    -0.09103387   -0.119463378
#> 206     0.01719779    0.341482037
#> 207     0.35429558   -0.008686632
#> 208     0.35429558    0.102381758
#> 209    -0.62542083    0.647745574
#> 210    -0.09103387   -0.119463378
#> 211    -0.32461579    0.480962199
#> 212     0.12496572   -0.355949378
#> 213    -0.09103387    0.102381758
#> 214     0.48625873   -0.355949378
#> 215     0.35429558    0.217552164
#> 216     0.64212441    0.102381758
#> 217     0.01719779   -0.008686632
#> 218     0.12496572   -0.233715303
#> 219    -0.32461579   -0.119463378
#> 220    -0.32461579   -0.492620587
#> 221    -0.20344194   -0.355949378
#> 222    -0.84239770    0.217552164
#> 223     0.12496572    0.480962199
#> 224     0.12496572    1.208333678
#> 225    -0.09103387    0.217552164
#> 226     0.01719779    0.102381758
#> 227     0.64212441    0.217552164
#> 228    -0.62542083   -0.233715303
#> 229    -0.20344194   -0.008686632
#> 230    -0.20344194   -0.119463378
#> 231    -1.18699295    0.647745574
#> 232    -0.46132203   -0.233715303
#> 233     0.01719779   -0.119463378
#> 234     0.01719779   -0.008686632
#> 235     0.48625873   -0.008686632
#> 236     0.64212441    0.102381758
#> 237    -0.09103387    0.341482037
#> 238     0.64212441   -0.355949378
#> 239     0.64212441   -0.233715303
#> 240    -0.32461579   -0.233715303
#> 241     0.35429558   -0.008686632
#> 242     0.64212441    0.217552164
#> 243     0.01719779   -0.008686632
#> 244    -0.32461579    0.480962199
#> 245    -0.09103387   -0.233715303
#> 246     0.23589905    0.341482037
#> 247     0.12496572   -0.355949378
#> 248     0.12496572    0.102381758
#> 249    -0.46132203   -0.654732979
#> 250     0.01719779    0.102381758
#> 251     0.48625873   -0.119463378
#> 252     0.23589905   -0.355949378
#> 253    -0.62542083    0.102381758
#> 254     0.35429558    0.217552164
#> 255    -0.09103387    0.341482037
#> 256    -0.20344194   -0.355949378
#> 257     0.23589905   -0.355949378
#> 258    -0.09103387   -0.355949378
#> 259     0.23589905   -0.233715303
#> 260     0.12496572   -0.355949378
#> 261    -0.09103387   -0.008686632
#> 262    -0.32461579    0.102381758
#> 263    -0.84239770   -0.355949378
#> 264     0.01719779   -0.008686632
#> 265     0.23589905   -0.119463378
#> 266     0.35429558   -0.119463378
#> 267     0.12496572   -0.355949378
#> 268    -0.09103387    0.102381758
#> 269     0.23589905   -0.008686632
#> 270    -0.20344194    0.102381758
#> 271    -0.46132203   -0.119463378
#> 272     0.84330449    0.102381758
#> 273     0.35429558    0.480962199
#> 274     0.01719779    0.217552164
#> 275    -0.09103387    0.341482037
#> 276    -0.09103387    0.647745574
#> 277     0.35429558   -0.355949378
#> 278     0.12496572    0.102381758
#> 279    -1.18699295   -0.008686632
#> 280     0.23589905   -0.119463378
#> 281     0.12496572    0.217552164
#> 282     0.12496572    0.102381758
#> 283    -0.20344194    0.102381758
#> 284     0.12496572   -0.654732979
#> 285    -0.09103387    0.102381758
#> 286     0.35429558    0.102381758
#> 287     0.12496572   -0.233715303
#> 288     0.35429558   -0.008686632
#> 289     0.12496572   -0.119463378
#> 290    -0.46132203   -0.492620587
#> 291    -0.32461579   -0.233715303
#> 292    -0.09103387   -0.008686632
#> 293     0.23589905   -0.355949378
#> 294     0.35429558   -0.654732979
#> 295     0.35429558    0.102381758
#> 296     0.12496572    0.102381758
#> 297    -0.09103387    0.102381758
#> 298     0.23589905    0.341482037
#> 299    -0.09103387   -0.233715303
#> 300    -0.62542083    0.341482037
#> 301     0.12496572   -0.119463378
#> 302     0.12496572   -0.355949378
#> 303     0.35429558   -0.119463378
#> 304     0.12496572   -0.492620587
#> 305    -0.09103387   -0.119463378
#> 306     0.01719779    0.341482037
#> 307     0.01719779    0.102381758
#> 308     0.01719779   -0.119463378
#> 309     0.12496572    0.217552164
#> 310    -0.32461579   -0.233715303
#> 311    -0.32461579    0.102381758
#> 312    -0.84239770    0.341482037
#> 313    -0.20344194   -0.008686632
#> 314     0.01719779    0.217552164
#> 315     0.01719779   -0.119463378
#> 316    -0.32461579   -0.008686632
#> 317     0.01719779   -0.008686632
#> 318    -0.20344194    0.102381758
#> 319    -0.20344194    0.102381758
#> 320     0.35429558    0.102381758
#> 321     0.35429558    0.217552164
#> 322     0.01719779    0.217552164
#> 323     0.48625873   -0.654732979
#> 324     0.12496572   -0.008686632
#> 325     0.35429558   -0.233715303
#> 326    -0.09103387   -0.119463378
#> 327    -0.32461579    0.217552164
#> 328     0.23589905    0.102381758
#> 329     0.23589905   -0.355949378
#> 330     0.01719779   -0.492620587
#> 331    -0.09103387    0.217552164
#> 332     0.64212441   -0.233715303
#> 333     0.48625873    0.102381758
#> 334    -0.84239770    0.341482037
#> 335     0.01719779    0.102381758
#> 336     0.48625873    2.059504266
#> 337    -0.09103387    0.647745574
#> 338     0.35429558   -0.119463378
#> 339    -0.62542083    0.217552164
#> 340    -0.20344194   -0.654732979
#> 341    -0.62542083    0.102381758
#> 342     0.12496572    0.341482037
#> 343    -0.20344194   -0.492620587
#> 344    -0.09103387    0.341482037
#> 345     0.48625873   -0.008686632
#> 346    -0.32461579    0.866646436
#> 347     0.01719779    0.217552164
#> 348     0.01719779   -0.008686632
#> 349    -0.09103387   -0.119463378
#> 350     0.64212441   -0.119463378
#> 351     0.01719779   -0.008686632
#> 352    -0.20344194    0.480962199
#> 353    -0.09103387   -0.355949378
#> 354     0.12496572    0.480962199
#> 355    -0.09103387   -0.008686632
#> 356     0.48625873    0.341482037
#> 357    -0.32461579   -0.119463378
#> 358    -0.20344194   -0.008686632
#> 359    -0.84239770    0.102381758
#> 360    -0.32461579   -0.008686632
#> 361    -0.46132203    0.102381758
#> 362    -0.32461579    0.341482037
#> 363     0.01719779   -0.119463378
#> 364     0.48625873    0.647745574
#> 365     0.12496572   -0.008686632
#> 366    -0.46132203   -0.233715303
#> 367     0.12496572   -0.008686632
#> 368     0.48625873   -0.119463378
#> 369     0.48625873   -0.008686632
#> 370     0.64212441   -0.355949378
#> 371     0.01719779    0.102381758
#> 372     0.12496572   -0.119463378
#> 373    -1.18699295    0.217552164
#> 374     0.23589905   -0.865189748
#> 375     0.84330449    0.217552164
#> 376     0.64212441    0.480962199
#> 377    -0.20344194    0.102381758
#> 378     1.90433036   -0.008686632
#> 379     0.12496572    0.102381758
#> 380    -0.84239770    0.341482037
#> 381     0.48625873   -0.233715303
#> 382    -0.46132203    0.102381758
#> 383     0.23589905    0.217552164
#> 384    -0.20344194   -0.233715303
#> 385     1.14993888    0.480962199
#> 386    -0.84239770   -0.119463378
#> 387    -0.09103387    0.102381758
#> 388    -0.62542083    0.102381758
#> 389    -0.09103387   -0.233715303
#> 390    -0.09103387    0.102381758
#> 391     0.01719779   -0.119463378
#> 392     0.35429558   -0.008686632
#> 393     0.01719779    0.341482037
#> 394    -0.32461579   -0.008686632
#> 395    -0.32461579   -0.008686632
#> 396    -0.20344194    0.217552164
#> 397    -0.20344194    0.217552164
#> 398    -0.09103387    0.102381758
#> 399     0.12496572   -0.119463378
#> 400     0.35429558   -0.355949378
#> 
#> $wle_correlation
#>   subscale_a subscale_b            r   ci_lower   ci_upper   p_value   n
#> 1          1          2 -0.005350613 -0.1033481 0.09274977 0.9150443 400
#> 

# Sequential stopping: stop as soon as h = 25 simulated statistics exceed
# the observed one (cuts compute time under H0).
RMdimMartinLof(dat,
            partition = c(1,1,1,1,2,2,2,2),
            iterations = 200, stopping = "sequential", h = 25,
            seed = 1)
#> $T_obs
#> [1] 192.632
#> 
#> $p_value
#> [1] 0.5531915
#> 
#> $p_value_floor
#> [1] 0.0212766
#> 
#> $actual_iterations
#> [1] 46
#> 
#> $rejected
#> [1] FALSE
#> 
#> $partition
#> $partition[[1]]
#> [1] 1 2 3 4
#> 
#> $partition[[2]]
#> [1] 5 6 7 8
#> 
#> 
#> $n_subscales
#> [1] 2
#> 
#> $is_polytomous
#> [1] TRUE
#> 
#> $sample_n
#> [1] 400
#> 
#> $n_items
#> [1] 8
#> 
#> $stopping
#> [1] "sequential"
#> 
#> $h
#> [1] 25
#> 
#> $T_rep
#>  [1] 217.3739 156.9169 178.9840 211.2337 190.9902 197.9099 200.7671 175.4362
#>  [9] 155.5236 213.5078 209.8393 212.2892 224.7373 200.0692 213.2293 218.6514
#> [17] 215.9354 185.6733 191.6138 184.7622 196.8899 193.1802 201.9903 196.4503
#> [25] 186.3135 185.5979 210.9303 178.3912 176.9220 198.5879 169.1423 197.1674
#> [33] 173.3412 191.4246 195.2852 226.3838 189.8889 182.4467 182.4824 204.9755
#> [41] 210.8322 205.7216 183.0040 169.7485 180.3166 206.8898
#> 
#> $wle_scores
#>     subscale_1_wle subscale_2_wle
#> 1       0.01719779   -0.008686632
#> 2       0.84330449   -0.233715303
#> 3       0.01719779   -0.233715303
#> 4      -0.46132203   -1.979433785
#> 5       0.48625873    0.217552164
#> 6       0.12496572   -0.008686632
#> 7      -0.20344194   -0.008686632
#> 8       0.12496572    0.341482037
#> 9       0.84330449   -0.355949378
#> 10      0.48625873    0.341482037
#> 11     -0.46132203   -0.233715303
#> 12     -0.46132203    0.341482037
#> 13     -0.46132203   -0.008686632
#> 14     -0.09103387   -0.119463378
#> 15      0.01719779    0.102381758
#> 16      0.01719779    2.059504266
#> 17      0.01719779   -0.355949378
#> 18      0.35429558   -0.492620587
#> 19      0.01719779    0.341482037
#> 20      0.01719779   -0.355949378
#> 21     -0.20344194   -0.233715303
#> 22      0.35429558    0.217552164
#> 23      0.48625873   -0.119463378
#> 24     -0.20344194    0.341482037
#> 25     -0.20344194    0.217552164
#> 26     -0.46132203    0.341482037
#> 27      0.23589905    0.102381758
#> 28      0.35429558   -0.355949378
#> 29      0.12496572    0.217552164
#> 30     -0.46132203   -0.119463378
#> 31      0.64212441   -1.188316539
#> 32      0.01719779    0.341482037
#> 33     -0.20344194    0.217552164
#> 34      0.12496572    0.217552164
#> 35      0.12496572   -0.008686632
#> 36     -0.09103387    0.341482037
#> 37      0.48625873   -0.355949378
#> 38      0.01719779    0.480962199
#> 39     -0.20344194   -0.008686632
#> 40     -0.32461579    0.480962199
#> 41      0.12496572   -0.008686632
#> 42     -0.09103387   -0.119463378
#> 43      0.35429558   -0.233715303
#> 44     -0.09103387   -0.355949378
#> 45     -0.09103387   -0.008686632
#> 46     -0.20344194    0.102381758
#> 47      0.48625873    0.480962199
#> 48     -0.20344194   -0.654732979
#> 49      0.48625873    0.341482037
#> 50      0.64212441    0.217552164
#> 51      0.23589905   -0.233715303
#> 52      0.84330449    0.647745574
#> 53      0.23589905   -0.119463378
#> 54      0.23589905   -0.119463378
#> 55     -0.32461579    0.341482037
#> 56      0.35429558    0.341482037
#> 57      0.01719779    0.647745574
#> 58      0.48625873    0.102381758
#> 59     -0.09103387   -0.008686632
#> 60      0.35429558   -0.233715303
#> 61     -0.32461579   -0.008686632
#> 62     -0.32461579   -0.233715303
#> 63      0.23589905   -0.119463378
#> 64      0.35429558   -0.008686632
#> 65     -0.32461579    0.341482037
#> 66     -0.20344194    0.217552164
#> 67     -0.46132203    0.217552164
#> 68     -0.20344194   -0.492620587
#> 69     -0.20344194   -0.233715303
#> 70     -0.20344194    0.102381758
#> 71     -0.84239770    0.341482037
#> 72     -0.46132203   -0.008686632
#> 73      0.23589905    0.102381758
#> 74      0.12496572    0.341482037
#> 75     -0.09103387   -0.008686632
#> 76      0.23589905   -0.008686632
#> 77     -0.32461579   -0.492620587
#> 78     -0.46132203   -0.355949378
#> 79      0.23589905   -0.355949378
#> 80      0.12496572    0.102381758
#> 81     -0.09103387   -0.233715303
#> 82      0.64212441   -0.355949378
#> 83     -0.20344194   -0.008686632
#> 84     -0.32461579   -0.355949378
#> 85      0.01719779   -0.233715303
#> 86      0.48625873   -0.119463378
#> 87      0.12496572   -0.355949378
#> 88      0.01719779    0.217552164
#> 89      0.01719779    0.102381758
#> 90      0.23589905   -0.119463378
#> 91      0.48625873    0.480962199
#> 92     -0.09103387    0.102381758
#> 93      0.01719779   -0.233715303
#> 94     -0.32461579   -0.119463378
#> 95      0.01719779    0.102381758
#> 96      0.48625873   -0.008686632
#> 97     -0.32461579    0.102381758
#> 98     -0.09103387   -0.119463378
#> 99      0.01719779   -0.233715303
#> 100    -0.09103387    0.480962199
#> 101    -0.46132203   -0.492620587
#> 102    -0.20344194   -0.119463378
#> 103     0.23589905   -0.008686632
#> 104    -0.20344194    0.480962199
#> 105    -0.20344194    0.102381758
#> 106     0.23589905   -0.355949378
#> 107     0.23589905   -0.492620587
#> 108    -0.20344194   -0.492620587
#> 109     0.48625873   -0.008686632
#> 110     0.01719779   -0.492620587
#> 111     0.64212441   -0.233715303
#> 112     0.35429558    0.217552164
#> 113    -0.09103387   -0.233715303
#> 114     0.23589905    0.102381758
#> 115    -0.09103387    0.647745574
#> 116     0.01719779    0.480962199
#> 117     0.64212441   -0.008686632
#> 118     0.23589905    0.102381758
#> 119     0.64212441   -0.355949378
#> 120     0.48625873    0.217552164
#> 121    -0.09103387   -0.492620587
#> 122     0.23589905   -0.233715303
#> 123     0.48625873    0.341482037
#> 124     0.35429558   -0.233715303
#> 125     0.01719779    0.647745574
#> 126     0.35429558    0.480962199
#> 127     0.01719779   -0.355949378
#> 128    -0.84239770   -0.492620587
#> 129     0.23589905   -0.008686632
#> 130     0.23589905   -0.119463378
#> 131    -0.46132203   -0.492620587
#> 132     0.12496572    0.341482037
#> 133     0.23589905   -0.233715303
#> 134    -0.09103387   -0.492620587
#> 135     0.23589905   -0.492620587
#> 136    -0.32461579   -0.654732979
#> 137    -0.09103387   -0.233715303
#> 138     0.12496572   -0.233715303
#> 139     0.12496572    0.217552164
#> 140     0.12496572   -0.492620587
#> 141    -0.46132203   -0.008686632
#> 142    -0.32461579    0.217552164
#> 143     0.01719779    0.217552164
#> 144     0.12496572    0.480962199
#> 145    -0.20344194    0.341482037
#> 146     0.12496572   -1.188316539
#> 147    -0.46132203   -0.355949378
#> 148    -0.09103387    0.341482037
#> 149     0.23589905    0.217552164
#> 150    -0.09103387    0.480962199
#> 151    -0.32461579   -0.865189748
#> 152     0.35429558   -0.008686632
#> 153     0.23589905   -0.008686632
#> 154     0.23589905    0.217552164
#> 155     0.12496572   -0.233715303
#> 156    -0.09103387    0.217552164
#> 157     0.48625873   -0.008686632
#> 158     0.23589905   -0.492620587
#> 159     0.01719779   -0.119463378
#> 160    -0.84239770   -0.233715303
#> 161    -0.20344194   -0.492620587
#> 162     0.35429558    0.102381758
#> 163     0.12496572   -1.188316539
#> 164    -0.09103387    0.341482037
#> 165    -0.46132203   -0.355949378
#> 166    -0.09103387    0.341482037
#> 167    -0.20344194    2.059504266
#> 168    -0.46132203    0.217552164
#> 169     0.12496572    0.217552164
#> 170     0.12496572    0.217552164
#> 171     0.01719779    0.217552164
#> 172     0.23589905    0.102381758
#> 173     0.35429558   -1.188316539
#> 174     0.35429558    0.217552164
#> 175     0.01719779   -0.355949378
#> 176    -0.09103387    0.102381758
#> 177    -0.62542083    0.102381758
#> 178     0.12496572   -0.008686632
#> 179     0.23589905    0.341482037
#> 180    -0.09103387    0.341482037
#> 181    -0.62542083   -0.008686632
#> 182     0.64212441    0.866646436
#> 183     0.84330449    0.480962199
#> 184     0.12496572   -0.008686632
#> 185    -0.32461579    0.217552164
#> 186    -0.09103387   -0.355949378
#> 187     0.12496572    2.059504266
#> 188     0.35429558   -0.865189748
#> 189     0.01719779   -0.355949378
#> 190     0.12496572   -0.355949378
#> 191     0.01719779   -0.119463378
#> 192    -0.09103387    0.341482037
#> 193     0.01719779   -0.865189748
#> 194    -1.18699295    0.341482037
#> 195     0.12496572    0.480962199
#> 196     0.84330449   -0.355949378
#> 197     0.48625873    0.102381758
#> 198     0.48625873   -0.233715303
#> 199    -0.32461579   -0.355949378
#> 200     0.35429558    0.102381758
#> 201     0.01719779   -0.008686632
#> 202     1.14993888    0.341482037
#> 203     0.12496572   -0.119463378
#> 204    -0.20344194    0.102381758
#> 205    -0.09103387   -0.119463378
#> 206     0.01719779    0.341482037
#> 207     0.35429558   -0.008686632
#> 208     0.35429558    0.102381758
#> 209    -0.62542083    0.647745574
#> 210    -0.09103387   -0.119463378
#> 211    -0.32461579    0.480962199
#> 212     0.12496572   -0.355949378
#> 213    -0.09103387    0.102381758
#> 214     0.48625873   -0.355949378
#> 215     0.35429558    0.217552164
#> 216     0.64212441    0.102381758
#> 217     0.01719779   -0.008686632
#> 218     0.12496572   -0.233715303
#> 219    -0.32461579   -0.119463378
#> 220    -0.32461579   -0.492620587
#> 221    -0.20344194   -0.355949378
#> 222    -0.84239770    0.217552164
#> 223     0.12496572    0.480962199
#> 224     0.12496572    1.208333678
#> 225    -0.09103387    0.217552164
#> 226     0.01719779    0.102381758
#> 227     0.64212441    0.217552164
#> 228    -0.62542083   -0.233715303
#> 229    -0.20344194   -0.008686632
#> 230    -0.20344194   -0.119463378
#> 231    -1.18699295    0.647745574
#> 232    -0.46132203   -0.233715303
#> 233     0.01719779   -0.119463378
#> 234     0.01719779   -0.008686632
#> 235     0.48625873   -0.008686632
#> 236     0.64212441    0.102381758
#> 237    -0.09103387    0.341482037
#> 238     0.64212441   -0.355949378
#> 239     0.64212441   -0.233715303
#> 240    -0.32461579   -0.233715303
#> 241     0.35429558   -0.008686632
#> 242     0.64212441    0.217552164
#> 243     0.01719779   -0.008686632
#> 244    -0.32461579    0.480962199
#> 245    -0.09103387   -0.233715303
#> 246     0.23589905    0.341482037
#> 247     0.12496572   -0.355949378
#> 248     0.12496572    0.102381758
#> 249    -0.46132203   -0.654732979
#> 250     0.01719779    0.102381758
#> 251     0.48625873   -0.119463378
#> 252     0.23589905   -0.355949378
#> 253    -0.62542083    0.102381758
#> 254     0.35429558    0.217552164
#> 255    -0.09103387    0.341482037
#> 256    -0.20344194   -0.355949378
#> 257     0.23589905   -0.355949378
#> 258    -0.09103387   -0.355949378
#> 259     0.23589905   -0.233715303
#> 260     0.12496572   -0.355949378
#> 261    -0.09103387   -0.008686632
#> 262    -0.32461579    0.102381758
#> 263    -0.84239770   -0.355949378
#> 264     0.01719779   -0.008686632
#> 265     0.23589905   -0.119463378
#> 266     0.35429558   -0.119463378
#> 267     0.12496572   -0.355949378
#> 268    -0.09103387    0.102381758
#> 269     0.23589905   -0.008686632
#> 270    -0.20344194    0.102381758
#> 271    -0.46132203   -0.119463378
#> 272     0.84330449    0.102381758
#> 273     0.35429558    0.480962199
#> 274     0.01719779    0.217552164
#> 275    -0.09103387    0.341482037
#> 276    -0.09103387    0.647745574
#> 277     0.35429558   -0.355949378
#> 278     0.12496572    0.102381758
#> 279    -1.18699295   -0.008686632
#> 280     0.23589905   -0.119463378
#> 281     0.12496572    0.217552164
#> 282     0.12496572    0.102381758
#> 283    -0.20344194    0.102381758
#> 284     0.12496572   -0.654732979
#> 285    -0.09103387    0.102381758
#> 286     0.35429558    0.102381758
#> 287     0.12496572   -0.233715303
#> 288     0.35429558   -0.008686632
#> 289     0.12496572   -0.119463378
#> 290    -0.46132203   -0.492620587
#> 291    -0.32461579   -0.233715303
#> 292    -0.09103387   -0.008686632
#> 293     0.23589905   -0.355949378
#> 294     0.35429558   -0.654732979
#> 295     0.35429558    0.102381758
#> 296     0.12496572    0.102381758
#> 297    -0.09103387    0.102381758
#> 298     0.23589905    0.341482037
#> 299    -0.09103387   -0.233715303
#> 300    -0.62542083    0.341482037
#> 301     0.12496572   -0.119463378
#> 302     0.12496572   -0.355949378
#> 303     0.35429558   -0.119463378
#> 304     0.12496572   -0.492620587
#> 305    -0.09103387   -0.119463378
#> 306     0.01719779    0.341482037
#> 307     0.01719779    0.102381758
#> 308     0.01719779   -0.119463378
#> 309     0.12496572    0.217552164
#> 310    -0.32461579   -0.233715303
#> 311    -0.32461579    0.102381758
#> 312    -0.84239770    0.341482037
#> 313    -0.20344194   -0.008686632
#> 314     0.01719779    0.217552164
#> 315     0.01719779   -0.119463378
#> 316    -0.32461579   -0.008686632
#> 317     0.01719779   -0.008686632
#> 318    -0.20344194    0.102381758
#> 319    -0.20344194    0.102381758
#> 320     0.35429558    0.102381758
#> 321     0.35429558    0.217552164
#> 322     0.01719779    0.217552164
#> 323     0.48625873   -0.654732979
#> 324     0.12496572   -0.008686632
#> 325     0.35429558   -0.233715303
#> 326    -0.09103387   -0.119463378
#> 327    -0.32461579    0.217552164
#> 328     0.23589905    0.102381758
#> 329     0.23589905   -0.355949378
#> 330     0.01719779   -0.492620587
#> 331    -0.09103387    0.217552164
#> 332     0.64212441   -0.233715303
#> 333     0.48625873    0.102381758
#> 334    -0.84239770    0.341482037
#> 335     0.01719779    0.102381758
#> 336     0.48625873    2.059504266
#> 337    -0.09103387    0.647745574
#> 338     0.35429558   -0.119463378
#> 339    -0.62542083    0.217552164
#> 340    -0.20344194   -0.654732979
#> 341    -0.62542083    0.102381758
#> 342     0.12496572    0.341482037
#> 343    -0.20344194   -0.492620587
#> 344    -0.09103387    0.341482037
#> 345     0.48625873   -0.008686632
#> 346    -0.32461579    0.866646436
#> 347     0.01719779    0.217552164
#> 348     0.01719779   -0.008686632
#> 349    -0.09103387   -0.119463378
#> 350     0.64212441   -0.119463378
#> 351     0.01719779   -0.008686632
#> 352    -0.20344194    0.480962199
#> 353    -0.09103387   -0.355949378
#> 354     0.12496572    0.480962199
#> 355    -0.09103387   -0.008686632
#> 356     0.48625873    0.341482037
#> 357    -0.32461579   -0.119463378
#> 358    -0.20344194   -0.008686632
#> 359    -0.84239770    0.102381758
#> 360    -0.32461579   -0.008686632
#> 361    -0.46132203    0.102381758
#> 362    -0.32461579    0.341482037
#> 363     0.01719779   -0.119463378
#> 364     0.48625873    0.647745574
#> 365     0.12496572   -0.008686632
#> 366    -0.46132203   -0.233715303
#> 367     0.12496572   -0.008686632
#> 368     0.48625873   -0.119463378
#> 369     0.48625873   -0.008686632
#> 370     0.64212441   -0.355949378
#> 371     0.01719779    0.102381758
#> 372     0.12496572   -0.119463378
#> 373    -1.18699295    0.217552164
#> 374     0.23589905   -0.865189748
#> 375     0.84330449    0.217552164
#> 376     0.64212441    0.480962199
#> 377    -0.20344194    0.102381758
#> 378     1.90433036   -0.008686632
#> 379     0.12496572    0.102381758
#> 380    -0.84239770    0.341482037
#> 381     0.48625873   -0.233715303
#> 382    -0.46132203    0.102381758
#> 383     0.23589905    0.217552164
#> 384    -0.20344194   -0.233715303
#> 385     1.14993888    0.480962199
#> 386    -0.84239770   -0.119463378
#> 387    -0.09103387    0.102381758
#> 388    -0.62542083    0.102381758
#> 389    -0.09103387   -0.233715303
#> 390    -0.09103387    0.102381758
#> 391     0.01719779   -0.119463378
#> 392     0.35429558   -0.008686632
#> 393     0.01719779    0.341482037
#> 394    -0.32461579   -0.008686632
#> 395    -0.32461579   -0.008686632
#> 396    -0.20344194    0.217552164
#> 397    -0.20344194    0.217552164
#> 398    -0.09103387    0.102381758
#> 399     0.12496572   -0.119463378
#> 400     0.35429558   -0.355949378
#> 
#> $wle_correlation
#>   subscale_a subscale_b            r   ci_lower   ci_upper   p_value   n
#> 1          1          2 -0.005350613 -0.1033481 0.09274977 0.9150443 400
#> 
# }