Provides optimization algorithms based on sequential
quadratic programming (SQP) for maximum likelihood estimation of the
mixture proportions in a finite mixture model where the component
densities are known. The algorithms are expected to obtain solutions
that are at least as accurate as the state-of-the-art MOSEK
interior-point solver (called by function "KWDual" in the 'REBayes'
package), and they are expected to arrive at solutions more quickly
in large data sets. The algorithms are described in Y. Kim,
P. Carbonetto, M. Stephens & M. Anitescu (2018)
The mixsqp R package provides algorithms based on sequential quadratic programming for maximum likelihood estimation of the mixture proportions in a finite mixture model where the component densities are known. The SQP algorithm is expected to obtain solutions that are at least as accurate as the state-of-the-art MOSEK interior-point solver (called via the "KWDual" function in the REBayes package), and is expected to compute these solutions much more quickly in large data sets.
For more details on the SQP algorithm, please see our paper on arXiv.
See also the Julia implementation, which, at time of writing, is faster than the R implementation, particularly for large data sets.
If you find a bug, or you have a question or feedback on our work, please post an issue.
If you find the mixsqp package or any of the source code in this repository useful for your work, please cite:
Anitescu. A fast algorithm for maximum likelihood estimation of mixture proportions using sequential quadratic programming. arXiv:1806.01412.
Copyright (c) 2017-2018, Youngseok Kim, Peter Carbonetto, Matthew Stephens and Mihai Anitescu.
Install mixsqp from CRAN:
For more detailed installation instructions, see the "Setup" section below.
Once you have installed the package, load the package in R:
Next, run the small example provided with the mixsqp function:
For a more detailed illustration of the SQP algorithm applied to the problem of computing maximum-likelihood estimates for a mixture model, read through the introductory vignette.
To learn more, visit the package website, or view the "mixsqp" help page:
To install mixsqp from CRAN, in R run:
Alternatively, to install the latest version of the mixsqp package from GitHub, use devtools:
This command should automatically install all required packages if they are not installed already.
If you have cloned the repository locally, you can install the package
install_local function from devtools. Assuming your working
directory contains the mixsqp repository, run this code to install the
library(devtools)list.files(pattern = "mixsqp") # Should output "mixsqp".install_local("mixsqp")
Compiling the mixsqp package from source will require a C++ compiler setup that is appropriate for the the R installed on your computer. For details, refer to the CRAN documentation. For Mac computers, see these notes.
To use the (optional) alternative solver, "mixkwdual", which is mostly useful for comparisons of the different optimization methods, you will need to install the REBayes package. The REBayes package, in turn, requires the Rmosek package. Refer to the MOSEK documentation for instructions on installing the Rmosek package. Once you have followed these steps, you can run this example to verify that Rmosek is correctly installed. Installation of the REBayes package also allows you to build the vignette and view it locally:
devtools::install_github("stephenslab/mixsqp",build_vignettes = TRUE)library(mixsqp)vignette("mixsqp-intro")
To install and test the mixsqp R package, run the following commands in the shell:
R CMD build mixsqpR CMD INSTALL mixsqp_0.1-97.tar.gzR CMD check --as-cran mixsqp_0.1-97.tar.gz
Note that these commands require that the dependencies have already been installed. See the DESCRIPTION file for details.
When any changes are made to roxygen2 markup or to the C++
code in the src directory, simply run
update the RcppExports.cpp, the NAMESPACE file,
and the package documentation files in the man directory.
Run this line of R code to build the website (make sure you have an Internet connection while running the code):
pkgdown::build_site(mathjax = FALSE)
.git/hooks in the git repository to
prevent commits that don't include a change to the package version.