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.

Value

A list with components:

T_obs

Observed Martin-Lof likelihood-ratio statistic.

p_value

Monte Carlo p-value with (n_exceed + 1) / (n + 1) correction.

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
#> 
#> $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] 203.7089 166.4718 207.7984 211.8912 215.1216 201.0546 203.3116 213.2795
#>   [9] 165.2963 208.9552 212.7167 194.5747 220.6339 205.2967 220.1806 209.6867
#>  [17] 214.6008 179.7504 209.8682 187.4194 181.8482 207.2870 199.5689 211.4619
#>  [25] 174.9074 191.5580 214.6926 172.0511 185.5416 192.4131 151.2155 204.4551
#>  [33] 172.1799 182.9760 175.2887 223.5755 194.7650 188.3222 189.9231 201.5607
#>  [41] 203.7943 193.9927 196.3285 173.0006 197.7298 181.9147 197.3194 190.2415
#>  [49] 193.7959 220.8859 189.8708 219.7969 194.3613 185.9662 174.8619 195.4499
#>  [57] 175.3000 171.1162 184.4898 176.4311 213.1694 190.8023 215.2947 216.7853
#>  [65] 184.8111 179.4693 194.5726 202.7966 231.1824 194.8544 221.5692 226.9352
#>  [73] 210.9863 193.9418 158.7622 177.4053 223.1777 228.2291 186.4018 203.8486
#>  [81] 177.0637 212.6582 214.3402 206.5206 174.8287 183.1892 199.5780 191.8738
#>  [89] 202.8738 209.9834 196.6661 151.4666 213.9526 190.0994 191.7499 189.5036
#>  [97] 187.6686 196.4909 213.8028 200.1645
#> 
#> $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.005   -0.103    0.093   0.915 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.6190476
#> 
#> $actual_iterations
#> [1] 41
#> 
#> $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] 203.7089 166.4718 207.7984 211.8912 215.1216 201.0546 203.3116 213.2795
#>  [9] 165.2963 208.9552 212.7167 194.5747 220.6339 205.2967 220.1806 209.6867
#> [17] 214.6008 179.7504 209.8682 187.4194 181.8482 207.2870 199.5689 211.4619
#> [25] 174.9074 191.5580 214.6926 172.0511 185.5416 192.4131 151.2155 204.4551
#> [33] 172.1799 182.9760 175.2887 223.5755 194.7650 188.3222 189.9231 201.5607
#> [41] 203.7943
#> 
#> $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.005   -0.103    0.093   0.915 400
#> 
# }