| Title: | Fit Two-Component Normal and Lognormal Mixture Models |
|---|---|
| Description: | Fits, bootstraps, and evaluates two-component normal and lognormal mixture models. Includes diagnostic plots and statistical evaluation of mixture model fits using differential evolution optimization. |
| Authors: | Farrokh Habibzadeh [aut, cre] |
| Maintainer: | Farrokh Habibzadeh <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-05-26 07:47:54 UTC |
| Source: | https://github.com/cran/DEmixR |
Bootstrap mixture parameters
bootstrap_mix2( fit = NULL, x = NULL, par = NULL, family = NULL, B = 1000, parametric = TRUE, boot_size = NULL, parallelType = 0, quiet = 2, ci_level = 0.95 )bootstrap_mix2( fit = NULL, x = NULL, par = NULL, family = NULL, B = 1000, parametric = TRUE, boot_size = NULL, parallelType = 0, quiet = 2, ci_level = 0.95 )
fit |
fitted object from fit_lognorm2 or fit_norm2 |
x |
numeric vector (if fit not provided) |
par |
numeric vector of parameters (if fit not provided) |
family |
"lognormal" or "normal" (if fit not provided) |
B |
number of bootstrap replicates |
parametric |
logical, parametric bootstrap if TRUE |
boot_size |
size or fraction (if between 0 and 1) of bootstrap sample |
parallelType |
integer for DEoptim/pbapply parallelism |
quiet |
0/1/2 for verbosity |
ci_level |
confidence level |
list with cleaned bootstrap estimates, central tendency, and CI
Evaluate initial parameter values for mixture fitting
evaluate_init( par_init, x, family = c("lognormal", "normal"), lower = NULL, upper = NULL, pgtol = 1e-08 )evaluate_init( par_init, x, family = c("lognormal", "normal"), lower = NULL, upper = NULL, pgtol = 1e-08 )
par_init |
numeric vector of initial parameters |
x |
numeric vector of data |
family |
"lognormal" or "normal" |
lower |
numeric vector of lower bounds |
upper |
numeric vector of upper bounds |
pgtol |
numeric, gradient tolerance for optim |
list with success flag, optimized parameters, log-likelihood, and convergence
Fit 2-component lognormal mixture
fit_lognorm2(x, ...)fit_lognorm2(x, ...)
x |
numeric vector of data to fit |
... |
additional arguments passed to |
list with fitted parameters and metrics
Fit 2-component normal mixture
fit_norm2(x, ...)fit_norm2(x, ...)
x |
numeric vector of data to fit |
... |
additional arguments passed to |
list with fitted parameters and metrics
Preliminary diagnostic plots
prelim_plots( x, which = c("hist"), hist_bins = 60, col_hist = "grey85", col_density = "darkorange", col_qq = "grey60", col_line = "darkorange" )prelim_plots( x, which = c("hist"), hist_bins = 60, col_hist = "grey85", col_density = "darkorange", col_qq = "grey60", col_line = "darkorange" )
x |
numeric vector |
which |
character vector: "hist", "qq", "pp", "logqq" |
hist_bins |
number of bins for histogram |
col_hist |
color for histogram |
col_density |
color for density line in histogram |
col_qq |
color for qq points |
col_line |
color for lines in "qq", "pp", "logqq" plots |
no return value, called for side effects (generating plots)
Select best mixture model (lognormal or normal) based on BIC
select_best_mixture(x, n_runs = 1, NP = 50, itermax = 10000, quiet = 2)select_best_mixture(x, n_runs = 1, NP = 50, itermax = 10000, quiet = 2)
x |
numeric vector |
n_runs |
number of DEoptim runs |
NP |
population size for DEoptim |
itermax |
maximum iterations |
quiet |
verbosity |
list with best fit, all fits, and BICs