knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Mixed, low-rank, and sparse multivariate regression (mixedLSR) provides tools for performing mixture regression when the coefficient matrix is low-rank and sparse. mixedLSR allows subgroup identification by alternating optimization with simulated annealing to encourage global optimum convergence. This method is data-adaptive, automatically performing parameter selection to identify low-rank substructures in the coefficient matrix.
library(mixedLSR) set.seed(1)
To demonstrate mixedLSR, we simulate a heterogeneous population where the coefficient matrix is low-rank and sparse and the number of coefficients to estimate is much larger than the sample size.
sim <- simulate_lsr(N = 100, k = 2, p = 30, m = 35)
Then, we compute the model. We limit the number of iterations the model can run.
model <- mixed_lsr(sim$x, sim$y, k = 2, alt_iter = 1, anneal_iter = 10, em_iter = 10, verbose = TRUE)
Next, we can evaluate the clustering performance of mixedLSR by viewing a cross-tabulation of the partition labels and by computing the adjusted Rand index (ARI). In this case, mixedLSR perfectly clustered the data.
table(sim$true, model$assign) ari <- mclust::adjustedRandIndex(sim$true, model$assign) print(paste("ARI:",ari))
Lastly, we can view a heatmap of the coefficient matrices and compare them to the true simulated matrices.
plot_lsr(model$a) plot_lsr(sim$a)
Reproducibility
sessionInfo()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.