decompose_within_between() now defaults to
components = 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. Pass
components = c("gmc", "between", "within") (or any subset
including "gmc") to restore the previous output.
Fixed print(..., format = "tt") on
mldesc() 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, which
tinytable silently drops when going through its
markdown-to-docx (Pandoc) conversion path; it is now written with
tinytable’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 the range column 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 in n_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(), and
decompose_within_between() now error informatively when a
variable in vars contains 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()
and within_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 to NA, with a
warning.
Test-only fix for compatibility with lavaan 0.7-1 (no
user-visible changes to mlstats itself).
Four method = "sem" tests depended on
lavaan converging 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 as
NA. 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.
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 (via lavaan), or Bayesian multilevel
modeling (via brms).
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
gt or tinytable objects via
print(result, format = "gt") or
print(result, format = "tt").
Includes the media_diary example dataset, a
simulated daily-diary study used throughout the documentation and
vignettes to illustrate within-person vs. between-person
relationships.