mlstats 0.1.1
decompose_within_between()now defaults tocomponents = c("between", "within"), so grand-mean-centered scores are no longer returned by default. Grand mean centering is rarely needed for REWB models (the within and between components are the actual predictors), so this avoids adding an extra column most callers don’t use. Passcomponents = c("gmc", "between", "within")(or any subset including"gmc") to restore the previous output.Fixed
print(..., format = "tt")onmldesc()output so that the Nobs column header renders “obs” as a proper subscript in Word/docx output, not just HTML. The header markup used a raw HTML<sub>obs</sub>tag, whichtinytablesilently drops when going through its markdown-to-docx (Pandoc) conversion path; it is now written withtinytable’s markdown subscript syntax (~obs~), consistent with the markdown italics (*N*) already used on the same label and with how the “a”/“b” correlation-note superscripts are marked elsewhere in the table.mldesc()now reports the observed minimum and maximum in therangecolumn with two decimals instead of rounding them to whole numbers (decimals are dropped when both the minimum and the maximum are whole numbers, e.g., for integer scales). Previously, a variable observed between 1.5 and 6.9 was reported as “2–7”, wrongly implying that the scale endpoints were observed.mldesc()now counts variables that are constant within every group (e.g., a trait measured once per person but repeated across that person’s rows) once per group inn_obs, reporting the number of groups that provided a value instead of the number of rows the value was replicated across.mldesc(),within_between_correlations(), anddecompose_within_between()now error informatively when a variable invarscontains only missing values (previously an uninformative low-level error could be triggered).Observations with a missing value on the grouping variable are no longer silently treated as a group of their own.
mldesc()andwithin_between_correlations()now warn and exclude them (previously they formed a spurious extra group in the correlations while being dropped from the ICC models);decompose_within_between()keeps the rows but sets their between- and within-group components toNA, with a warning.-
Test-only fix for compatibility with lavaan 0.7-1 (no user-visible changes to
mlstatsitself).Four
method = "sem"tests depended onlavaanconverging on an inadmissible (negative between-level variance) solution for particular degenerate/small-sample models, either expecting.wb_cor_sem()’s “out-of-range” warning to fire or a specific between-group correlation to come back asNA. lavaan 0.7-1 converges on an admissible solution instead for those same models, so the warning no longer fires and a valid correlation is returned. Three of the affected tests now simply suppress any warning instead of requiring the “out-of-range” one, since that warning was incidental to what they actually check (flip= symmetry, print methods, between-only variable handling). The fourth test, which checks that within-only variables are excluded from the between-group model, now constructs a variable with exactly zero between-group variance so it exercises that exclusion path deterministically rather than relying on lavaan returning an improper estimate.The package’s test suite now passes with both lavaan 0.6-21 and lavaan 0.7-1.
mlstats 0.1.0
CRAN release: 2026-07-11
Initial CRAN release.
within_between_correlations()computes within-group and between-group correlations for nested data (e.g., repeated measurements per person, or students nested within schools), using one of three methods: variance decomposition (default), two-level structural equation modeling (vialavaan), or Bayesian multilevel modeling (viabrms).mldesc()creates publication-ready descriptive statistics tables that combine means, SDs, ranges, intraclass correlation coefficients (ICCs), and within-/between-group correlations in a single table.decompose_within_between()decomposes variables into within-group and between-group components for use in Random Effects Within-Between (REWB) models.Result tables print as tibbles by default and can be exported as
gtortinytableobjects viaprint(result, format = "gt")orprint(result, format = "tt").Includes the
media_diaryexample dataset, a simulated daily-diary study used throughout the documentation and vignettes to illustrate within-person vs. between-person relationships.
