Learn R Programming

Welcome to R package admix

The goal of admix is to provide code for estimation, hypothesis testing and clustering methods in admixture models.

We remind that an admixture model has the following cumulative distribution function (cdf) $$ L(x) = pF(x) + (1-p)G(x), \qquad x \in \mathbb{R}, $$

where $G$ is a perfectly known cdf, and $p$ and $F$ are unknown.

The cdf $F$ relates to the contamination phenomenon that is added to the well-known signal $G$, with proportion $p$.

The proportion of the unknown component in the two-component mixture model can be easily estimated under weak nonparametric assumptions on the related distribution. The decontaminated version of this unknown component distribution can then be tested against some other specified distribution (included another decontaminated unknown component). Finally, clustering of $K$ populations is made possible, based on hypothesis tests that compare unknown component distributions. The package is suited to one-sample as well as multi-samples analysis.

Installation

You can install the released version of admix from Github with:

#once on CRAN with : install.package("admix")
# from now on:
remotes::install_git("git@github.com:XavierMilhaud/admix.git", build_manual = TRUE, build_vignettes = TRUE)

The optional argument build_vignettes can be set to TRUE to get vignettes that help to understand the functionalities of the package.

To get some help about the functionalities of the package, do once installed:

help(package = 'admix')

More details can also be found through the vignettes, available in admix github-pages (see https://xaviermilhaud.github.io/admix-Rpackage/, in Menu Articles).

Example

This is a basic example which shows you how to estimate the unknown component proportion and the localization shift parameters in an admixture model where the unknown component density is assumed to be symmetric. In practice, the cdf $L$ is given by $$ L(x) = p F(x-\mu) + (1-p) G(x), \qquad x \in \mathbb{R}, $$ where $p$ is the unknown component weight, and $\mu$ is the localization shift parameter of the unknown cdf $F$ with symmetric density.

The estimation would be made through the following commands:

library(admix)
#> Package 'admix' version 2.3.1
#> -------------------------------
#> Type 'citation("admix")' for citing this R package in publications.
#> -------------------------------
#> This work was partly conducted within the Research Chair DIALog under the aegis of the Risk Foundation, an initiative by CNP Assurances.
## Simulate mixture data:
mixt1 <- twoComp_mixt(n = 450, weight = 0.4,
                      comp.dist = list("norm", "norm"),
                      comp.param = list(list("mean" = -2, "sd" = 0.5),
                                        list("mean" = 0, "sd" = 1)))
data1 <- getmixtData(mixt1)
## Define the admixture models:
admixMod1 <- admix_model(knownComp_dist = mixt1$comp.dist[[2]],
                         knownComp_param = mixt1$comp.param[[2]])
## Estimation step:
admix_estim(samples = list(data1),
            admixMod = list(admixMod1),
            est.method = 'BVdk', sym.f = TRUE)
#> Call:
#> admix_estim(samples = list(data1), admixMod = list(admixMod1), 
#>     est.method = "BVdk", sym.f = TRUE)
#> 
#> Estimated mixing weight of the unknown component distribution in Sample 1: 0.4
#> 
#> Estimated location parameters of the unknown component distribution in Sample 1: -2.09

Copy Link

Version

Install

install.packages('admix')

Monthly Downloads

757

Version

2.4.3

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Xavier Milhaud

Last Published

August 21st, 2025

Functions in admix (2.4.3)

get_cluster_sizes

Extractor for object of class 'admix_cluster'
plot.admix_model

Plot method for objects of class 'admix_model'
mortality_sample

Dataset of deaths statistics in 11 european countries
orthobasis_test

Equality test of two unknown component distributions using polynomial expansions
get_mixing_weights

Extractor for objects of class 'admix_estim' or 'htest'
print.admix_estim

Print method for object of class 'admix_estim'
milkyWay

Dataset of heliocentric velocity for the Milky Way
get_mixture_data

Extractor for object of class 'twoComp_mixt'
print.admix_model

Print method for objects of class 'admix_model'
is_equal_knownComp

Equality of known components in two admixture models
reject_nullHyp

Extractor for object of class 'htest'
print.twoComp_mixt

Print method for objects 'twoComp_mixt'
get_statistic_components

Extractor for object of class 'IBM_test'
get_tabulated_dist

Extractor for object of class 'IBM_test'
print.estim_IBM

Print method for objects of class 'estim_IBM'
plot.twoComp_mixt

Plots several mixture densities on the same graph
print.admix_cluster

Print method for object of class 'admix_cluster'
summary.estim_PS

Summary method for objects 'estim_PS'
summary.estim_IBM

Summary method for objects 'estim_IBM'
print.estim_PS

Print method for objects of class 'estim_PS'
twoComp_mixt

Simulation of a two-component mixture model
summary.twoComp_mixt

Summary method for objects 'twoComp_mixt'
plot.decontaminated_density

Plot method for object of class 'decontaminated_density'
print.decontaminated_density

Print method for object of class 'decontaminated_density'
stmf_small

Dataset of Short-term Mortality Fluctuations (STMF) from HMD
summary.admix_estim

Summary method for object of class 'admix_estim'
summary.admix_model

Summary method for objects of class 'admix_model'
which_rank

Extractor for object of class 'htest'
summary.estim_BVdk

Summary method for objects 'estim_BVdk'
summary.decontaminated_density

Summary method for object of class 'decontaminated_density'
print.estim_BVdk

Print method for objects 'estim_BVdk'
summary.admix_cluster

Summary method for object of class 'admix_cluster'
IBM_k_samples_test

Equality test of K unknown component distributions
admix_estim

Estimate the unknown weight in the admixture model
admix_test

Equality test for the unknown components of admixture models
detect_support_type

Detect the type of support of some random variables
admix_model

Define the distribution/parameter(s) of the known component
admix_cluster

Cluster K populations following admixture models
decontaminated_density

Probability density function of the unknown component
get_discrepancy_matrix

Extractor for object of class 'IBM_test' or 'admix_cluster'
get_discrepancy_rank

Extractor for object of class 'IBM_test'
get_discrepancy_id

Extractor for object of class 'IBM_test'
get_known_component

Extractor for objects of class 'admix_estim', 'htest' or 'admix_cluster'
get_cluster_members

Extractor for object of class 'admix_cluster'
decontaminated_cdf

Estimates the decontaminated CDF of the unknown component in an admixture
gaussianity_test

Gaussianity test in an admixture model
estim_BVdk

Estimation of the admixture parameters by Bordes & Vandekerkhove (2010)
estim_IBM

Estimates weights of unknown components from 2 admixtures using IBM
estim_PS

Estimates in an admixture using Patra and Sen approach
allGalaxies

Measurements of heliocentric velocities
admix-package

admix: Package Admix for Admixture (aka Contamination) Models