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). Complete cases only: rows with any NA on the items named in partition are dropped. Missingness on items outside partition is ignored.

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 and regardless of the parallel setting. See easyRasch2-reproducibility for what this guarantees and how it interacts with parallel.

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, counted over the items in partition only.

sample_n_total

Number of respondents in the raw input data, before the complete-case filter.

sample_has_na

Logical. Whether the partitioned items contained any missing values.

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. Step (b) uses the recursive \(\gamma\)-function algorithm (Andersen, 1995, eq. 15.22 and 15.27) for dichotomous and polytomous items alike: items are filled in from the last backwards, each conditional on the score still to be distributed over the items before it. The nested \(\gamma^{(1)}, \ldots, \gamma^{(n)}\) depend only on the item parameters, which are fixed across the run, so the recursion is evaluated once rather than per person.

The faster dichotomous shortcut described by Christensen & Kreiner (2007, p. 23), choosing \(s\) items one at a time with probabilities \(\phi_i / \sum_{\mathrm{remaining}} \phi\), is deliberately not used: successive sampling of that kind follows a Wallenius-type distribution, whereas the Rasch conditional distribution weights a set of items by the product of their easinesses. See the note on validation below.

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.

Missing data. Complete cases only. The statistic is built from the joint table of subscores, so a respondent needs a defined subscore on every subscale; there is no partial-missingness path, and the SAS macro this implementation was validated against has the same requirement. Rows with NA are dropped after items outside partition have been removed, so missingness on items the test does not use costs no respondents. sample_n reports the respondents analysed and sample_n_total the raw input rows.

Validation. The statistic, the conditional log-likelihoods, the conditional sampler and the expected counts and residuals of RMdimMartinLofResiduals have been checked against the pml SAS macro (Christensen, 2004), kindly shared by Karl Bang Christensen. The statistic and the residual table agree with the macro to numerical precision. The sampler follows the macro's recursion rather than the dichotomous shortcut published in Christensen & Kreiner (2007).

References

Andersen, E. B. (1995). Polytomous Rasch models and their estimation. In G. H. Fischer & I. W. Molenaar (Eds.), Rasch models: Foundations, recent developments, and applications (pp. 271-291). Springer-Verlag.

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

Christensen, K. B. (2004). pml: A SAS macro for testing unidimensionality in polytomous Rasch models (Technical note). National Institute of Occupational Health, Denmark, and Department of Biostatistics, University of Copenhagen.

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

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.5544554
#> 
#> $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
#> 
#> $sample_n_total
#> [1] 400
#> 
#> $sample_has_na
#> [1] FALSE
#> 
#> $n_items
#> [1] 8
#> 
#> $stopping
#> [1] "none"
#> 
#> $h
#> [1] NA
#> 
#> $T_rep
#>   [1] 203.1150 191.4289 205.5340 200.9726 186.1371 211.4777 208.6398 246.5549
#>   [9] 235.7000 209.6456 242.6280 174.6350 181.3583 190.5831 212.3751 201.5643
#>  [17] 166.3843 199.5976 211.6393 180.1643 186.0512 173.5937 187.3779 205.7209
#>  [25] 187.0434 217.6454 178.8351 198.6360 210.9413 186.0347 182.6325 190.8734
#>  [33] 191.0037 172.3550 205.6651 183.5835 172.5252 199.6062 213.2993 214.1189
#>  [41] 200.0631 197.1147 206.1826 186.1101 193.9344 169.4966 177.8228 215.9291
#>  [49] 194.2733 196.1078 183.3993 195.3645 172.1005 187.8224 162.7854 201.0410
#>  [57] 214.2024 206.7241 196.1481 188.2455 184.4610 203.6818 161.3601 181.7351
#>  [65] 175.0302 198.2537 210.1757 195.7541 206.0021 214.4578 195.7307 199.5314
#>  [73] 192.2892 175.0420 184.2887 186.3762 177.6986 234.1348 184.9654 201.5393
#>  [81] 164.3802 204.3653 196.8265 207.3065 162.1215 210.6383 225.2370 227.8416
#>  [89] 192.4692 172.7222 200.3062 205.6332 214.2759 236.0662 186.4794 200.7419
#>  [97] 177.7558 210.2142 185.6626 183.6979
#> 
#> $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.5652174
#> 
#> $p_value_floor
#> [1] 0.02173913
#> 
#> $actual_iterations
#> [1] 45
#> 
#> $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
#> 
#> $sample_n_total
#> [1] 400
#> 
#> $sample_has_na
#> [1] FALSE
#> 
#> $n_items
#> [1] 8
#> 
#> $stopping
#> [1] "sequential"
#> 
#> $h
#> [1] 25
#> 
#> $T_rep
#>  [1] 203.1150 191.4289 205.5340 200.9726 186.1371 211.4777 208.6398 246.5549
#>  [9] 235.7000 209.6456 242.6280 174.6350 181.3583 190.5831 212.3751 201.5643
#> [17] 166.3843 199.5976 211.6393 180.1643 186.0512 173.5937 187.3779 205.7209
#> [25] 187.0434 217.6454 178.8351 198.6360 210.9413 186.0347 182.6325 190.8734
#> [33] 191.0037 172.3550 205.6651 183.5835 172.5252 199.6062 213.2993 214.1189
#> [41] 200.0631 197.1147 206.1826 186.1101 193.9344
#> 
#> $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
#> 
# }