## Simulate mixture data:
mixt1 <- twoComp_mixt(n = 200, weight = 0.4,
comp.dist = list("norm", "norm"),
comp.param = list(list("mean" = -2, "sd" = 0.5),
list("mean" = 0, "sd" = 1)))
## Retrieves the mixture data:
data1 <- getmixtData(mixt1)
## Define the admixture model:
admixMod <- admix_model(knownComp_dist = mixt1$comp.dist[[2]],
knownComp_param = mixt1$comp.param[[2]])
## Perform the estimation of parameters in real-life:
estim_BVdk(samples = data1, admixMod = admixMod, method = 'L-BFGS-B')
## Second example:
mixt2 <- twoComp_mixt(n = 200, weight = 0.65,
comp.dist = list("norm", "exp"),
comp.param = list(list("mean" = -1, "sd" = 0.5),
list("rate" = 1)))
data2 <- getmixtData(mixt2)
admixMod2 <- admix_model(knownComp_dist = mixt2$comp.dist[[2]],
knownComp_param = mixt2$comp.param[[2]])
## Perform the estimation of parameters in real-life:
estim_BVdk(samples = data2, admixMod = admixMod2, method = 'L-BFGS-B',
compute_var = TRUE)
Run the code above in your browser using DataLab