Introduction to mixedLSR

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Setup

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)

Simulate Data

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)

Compute Model

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)

Clustering Performance

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))

Coefficient Heatmaps

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()


Try the mixedLSR package in your browser

Any scripts or data that you put into this service are public.

mixedLSR documentation built on Nov. 10, 2022, 6:17 p.m.