This release corrects the numerical objective, checks optimizer convergence, adds input validation, diagnostics and new plots. Several changes alter numerical results; see “Changes that can alter results”.
sum(log(density + 1e-12)), which capped the contribution of
every observation whose mixture density was below 1e-12. The previous
objective used density_floor = 1e-12; this option is no
longer part of the public API. Log-likelihoods, AIC, BIC and, for data
with extreme observations, the fitted parameters can differ from 0.2.0.
Note that the floor acted as an implicit robustification: with the exact
likelihood a single extreme observation can attract a component of its
own. This is reported by the new diagnostics (see below).optim() reports convergence code 0.
Otherwise a warning is given and the unrefined DE solution is returned
(fit$source == "DEoptim_nolocal").
fit$convergence and fit$message now describe
the returned candidate (0.2.0 always reported the run started from the
DE solution).n_runs.
fit_norm2(), fit_lognorm2() now default to
n_runs = 10 (was 20). select_best_mixture()
now uses the same defaults as the fitting functions,
n_runs = 10, NP = 100 (was 1 and 50).central is now the
median for both families (0.2.0: mean for normal,
median for lognormal; use center = "mean"); the mean and
median are always returned."pp" panel of
prelim_plots() is now a proper normal P-P plot. In 0.2.0 it
plotted the sorted empirical-CDF values against the observation index,
which is the same straight line for any data set.mix2_bounds() (exported) returns the data-derived
parameter bounds; the scale limits and the range of the mixing
proportion are controlled with scale_range and
p_range. The bounds are documented: the mean bounds are
not split at the median.x must be finite (no NA/NaN/Inf) with
at least 10 observations and non-zero variance; a warning is given for n
< 50; user bounds must have length 5, be finite and ordered, and stay
inside the model.source,
local_convergence, the bounds (lower,
upper), settings, de_logLik
(log-likelihood of each DE run) and diagnostics. Warnings
and print()/summary() notes flag solutions on
a bound of the parameter box and components whose expected size (sum of
posterior probabilities) is below min_comp_n (default
5).scale_ratio argument (default 0 = off): a Hathaway
(1985)-type relative constraint
min(s1, s2) / max(s1, s2) >= scale_ratio, enforced by a
quadratic penalty; the reported log-likelihood is the exact one. It is
inherited by bootstrap_mix2() from the fit.bootstrap_mix2(refit = "de") repeats a
differential-evolution search for every replicate
(de_control); refit = "local" (default) is the
fast local refit of 0.2.0 and is documented as not propagating
multimodality. Failed replicates are counted
(n_failed).plot(fit, which = "pit") and which = "qq"
compare the data with the fitted mixture. prelim_plots()
gains "logpp".select_best_mixture(criterion = "BIC" | "AIC"); errors
of an individual family fit are reported instead of being
swallowed.parallelType = 1 requires the parallelly
package because DEoptim does; it is listed under
Suggests and a clear error is given if missing. The
parallel objective is now self-contained for PSOCK workers, so internal
DEmixR functions are not required on the worker search path. The
numerical objective and the meanings of parallelType are
unchanged. DEoptim uses 0 = serial, 1 =
parallel, and 2 = foreach.bootstrap_mix2(), parallelType is the
number of forked processes (values 0 and 1 run serially; ignored on
Windows); the documentation of 0.2.0 described it as the DEoptim
setting.m/s are
meanlog/sdlog; Q-Q/P-P panels are
exploratory.Fitted objects now have S3 classes and methods.
fit_norm2() and fit_lognorm2() return objects
of class demixr_fit with print(),
summary(), and plot() methods;
bootstrap_mix2() returns a demixr_boot object
and select_best_mixture() a demixr_select
object, each with a print() method. plot()
draws the fitted mixture density together with its two component
densities over a histogram of the data.
prelim_plots() gains the ability to suppress the
kernel-density overlay: passing col_density = NA omits the
density curve, and the histogram title changes from
"Histogram with density" to
"Histogram".
bootstrap_mix2() now honors quiet = 0:
the progress bar is suppressed when quiet = 0, matching the
documented behavior of the fitting functions.
The unused parallelly dependency has been removed.
Parallel execution is unchanged and is still requested through the
parallelType argument (handled by DEoptim for
the global search and by pbapply for the
bootstrap).
Executable examples have been added to all exported functions.
The test suite has been expanded and now uses testthat edition 3.