Skip to contents

Tabulate the distribution related to the inner convergence part of the contrast, by simulating trajectories of Gaussian processes and applying some transformations. Useful to perform the test hypothesis, by retrieving the (1-alpha)-quantile of interest. See 'Details' below and the cited paper therein for further information.

Usage

IBM_tabul_stochasticInteg(
  samples,
  admixMod,
  min_size = NULL,
  n.varCovMat = 80,
  n_sim_tab = 100,
  parallel = FALSE,
  n_cpu = 2
)

Arguments

samples

A list of the two samples under study.

admixMod

A list of two objects of class 'admix_model', with information about distributions and parameters.

min_size

(optional, NULL by default) In the k-sample case, useful to provide the minimal size among all samples (needed to take into account the correction factor for variance-covariance assessment). Otherwise, useless.

n.varCovMat

(default to 80) Number of time points at which the Gaussian processes are simulated.

n_sim_tab

(default to 100) Number of simulated Gaussian processes when tabulating the inner convergence distribution in the 'icv' testing method using the IBM estimation approach.

parallel

(default to FALSE) Boolean to indicate whether parallel computations are performed (speed-up the tabulation).

n_cpu

(default to 2) Number of cores used when paralleling computations.

Value

A list with four elements, containing: 1) random draws of the contrast as defined in the reference given here; 2) estimated unknown component weights for the two admixture models; 3) the value of the the empirical contrast; 4) support that was used to evaluate the variance-covariance matrix of the empirical processes.

References

Milhaud X, Pommeret D, Salhi Y, Vandekerkhove P (2024). “Two-sample contamination model test.” Bernoulli, 30(1), 170--197. doi:10.3150/23-BEJ1593 .

Author

Xavier Milhaud xavier.milhaud.research@gmail.com

Examples

# \donttest{
## Simulate mixture data:
mixt1 <- twoComp_mixt(n = 1200, weight = 0.4,
                      comp.dist = list("norm", "norm"),
                      comp.param = list(list("mean" = -2, "sd" = 0.5),
                                        list("mean" = 0, "sd" = 1)))
mixt2 <- twoComp_mixt(n = 1000, weight = 0.7,
                      comp.dist = list("norm", "norm"),
                      comp.param = list(list("mean" = -2, "sd" = 0.5),
                                        list("mean" = 1, "sd" = 1)))
data1 <- getmixtData(mixt1)
data2 <- getmixtData(mixt2)
## Define the admixture models:
admixMod1 <- admix_model(knownComp_dist = mixt1$comp.dist[[2]],
                         knownComp_param = mixt1$comp.param[[2]])
admixMod2 <- admix_model(knownComp_dist = mixt2$comp.dist[[2]],
                         knownComp_param = mixt2$comp.param[[2]])
IBM_tabul_stochasticInteg(samples = list(data1, data2), admixMod = list(admixMod1, admixMod2),
                          min_size=NULL, n.varCovMat=20, n_sim_tab=2, parallel=FALSE, n_cpu=2)
#> Warning:  IBM estimators of two unknown proportions are reliable only if the two
#>     corresponding unknown component distributions have been tested equal (see 'admix_test()').
#>     Furthermore, when both the known and unknown component distributions of the mixture
#>     models are identical, the IBM approach provides an estimation of the ratio of the
#>     actual mixing weights rather than an estimation of the unknown weights themselves.
#> $U_sim
#> [1] 0.07155802 0.30318710
#> 
#> $estimator
#> Call:estim_IBM(samples = samples, admixMod = admixMod, n.integ = 1000)
#> 
#> Estimated mixing proportion (of the unknown component) in the 1st sample:  0.452 
#> Estimated mixing proportion (of the unknown component) in the 2nd sample:  0.79 
#> Variance of the estimator of the mixing proportion in the 1st sample:  NA 
#> Variance of the estimator of the mixing proportion in the 2nd sample:  NA 
#> 
#> 
#> $contrast_value
#> [1] 0.12495
#> 
#> $integ.points
#>  [1] -3.4815454 -3.1141774 -2.7468095 -2.3794415 -2.0120736 -1.6447056
#>  [7] -1.2773377 -0.9099697 -0.5426018 -0.1752338  0.1921341  0.5595021
#> [13]  0.9268700  1.2942380  1.6616059  2.0289738  2.3963418  2.7637097
#> [19]  3.1310777  3.4984456
#> 
# }