A real-data example: riboflavin production in B. subtilis

library(EMLMLasso)

The data

riboflavinV100 is a longitudinal version of the well-known riboflavin production dataset for Bacillus subtilis (Bühlmann, Kalisch and Meier, 2014), reconstructed from the metadata in the original microarray file names to reproduce the longitudinal structure of the real-data application in Oliveira, Schumacher and Lachos (2026, Section 5): 28 strains, each measured 2-4 times, 71 observations in total. See ?riboflavinV100 for more information.

data(riboflavinV100)
dim(riboflavinV100)
#> [1]  71 103
table(table(riboflavinV100$strain))
#> 
#>  2  3  4 
#> 14 13  1

strain is the grouping variable, time is measured in hours after induction, y is log riboflavin production, and the remaining 100 columns are gene expression levels – the same 100-gene reduction used by the paper itself.

Fitting

Two data-prep choices are made before fitting, both following Section 5 of Oliveira et al. (2026). First, the response and all covariates (the 100 genes and time) are standardized to mean 0 and variance 1. Second, time is included as a candidate fixed-effect covariate, in addition to being a random slope via formRandom, matching the model structure of Eq. 14 of the paper. Coefficients are therefore reported on the standardized scale.

We also set refit = TRUE. Lasso coefficients are shrunk toward zero by construction, which biases them as point estimates even once the right covariates are selected; refit = TRUE follows the BIC-optimal lasso fit with an ordinary, unpenalized lme4::lmer() fit on just the covariates it selected, and reports those as the coefficients below. This is a point-estimate correction only – the refit’s standard errors, p-values and confidence intervals are not valid inference, because the covariate set was chosen using the same data, and ignoring that selection step would understate their uncertainty. EMLMLasso() does not print or summarize refit-based inferential statistics for this reason; the underlying lme4 fit is available as refit_fit, but its inferential output should not be used.

genes <- setdiff(names(riboflavinV100), c("strain", "time", "y"))
fixedForm <- as.formula(paste("y ~ time +", paste(genes, collapse = " + ")))

riboflavinV100_std <- riboflavinV100
std_vars <- c("y", "time", genes)
riboflavinV100_std[std_vars] <- lapply(riboflavinV100_std[std_vars],
                                       function(v) as.numeric(scale(v)))

set.seed(2026)
search <- EMLMLasso(riboflavinV100_std, formFixed = fixedForm, groupVar = "strain",
                    formRandom = ~ time, MaxIter = 500, refit = TRUE)

Results

search
#> EM algorithm for lasso-penalized linear mixed models
#> Call:
#> EMLMLasso(data = riboflavinV100_std, formFixed = fixedForm, groupVar = "strain", 
#>     formRandom = ~time, MaxIter = 500, refit = TRUE)
#> 
#> BIC search over 30 lambda values
#> 
#> lambda: 0.005054  | active covariates: 23 of 101 
#> 
#> Fixed effects (non-zero only):
#>      time   AHPC_at    ALD_at   CARA_at DEGQ_r_at   ETFB_at    GAP_at   GLPD_at 
#>   -0.1794    0.0705    0.1201   -0.0082    0.0161   -0.0120    0.1303   -0.0111 
#>   GUAB_at   LICA_at   NADC_at   PCKA_at   TRXA_at   XHLA_at   XLYA_at   YCGN_at 
#>    0.0713    0.0429    0.0163    0.0727    0.1808    0.0142    0.1416   -0.1921 
#>   YCGO_at   YPUG_at   YTGA_at   YTGB_at   YTGD_at   YUKE_at   YXLE_at 
#>   -0.0559    0.1865   -0.0432   -0.0050   -0.0395   -0.0253   -0.3034 
#> 
#> Random effects covariance (D):
#>             (Intercept)   time
#> (Intercept)      0.0723 0.0969
#> time             0.0969 0.1322
#> 
#> Residual variance: 0.012 
#> logLik: 1.7098  AIC: 50.5804  BIC: 111.6728 
#> EM iterations: 237  
#> 
#> Post-selection refit (unpenalized lme4::lmer(), point estimates only --
#> do NOT use its SEs/p-values/CIs, they ignore the selection step):
#>      time   AHPC_at    ALD_at   CARA_at DEGQ_r_at   ETFB_at    GAP_at   GLPD_at 
#>   -0.0792    0.0202    0.1662   -0.0078   -0.0129   -0.0254    0.0591    0.0219 
#>   GUAB_at   LICA_at   NADC_at   PCKA_at   TRXA_at   XHLA_at   XLYA_at   YCGN_at 
#>    0.0991    0.1566    0.0402    0.1121    0.2730   -0.1197    0.2391   -0.2414 
#>   YCGO_at   YPUG_at   YTGA_at   YTGB_at   YTGD_at   YUKE_at   YXLE_at 
#>    0.0116    0.2660   -0.1793    0.1681   -0.0482   -0.1385   -0.4640
plot(search)

The BIC-optimal model keeps 22 genes plus time. The coefficients below are the post-selection refit’s point estimates, not the raw (shrunk) lasso ones:

b <- coef(search, refit = TRUE)
sort(abs(b[!is.na(b) & b != 0]), decreasing = TRUE)
#>    YXLE_at    TRXA_at    YPUG_at    YCGN_at    XLYA_at    YTGA_at    YTGB_at 
#> 0.46397353 0.27299888 0.26600326 0.24143907 0.23905989 0.17928242 0.16811420 
#>     ALD_at    LICA_at    YUKE_at    XHLA_at    PCKA_at    GUAB_at       time 
#> 0.16623040 0.15657286 0.13854624 0.11968885 0.11209665 0.09905463 0.07921994 
#>     GAP_at    YTGD_at    NADC_at    ETFB_at    GLPD_at    AHPC_at  DEGQ_r_at 
#> 0.05912060 0.04823871 0.04023415 0.02536798 0.02190597 0.02016278 0.01288816 
#>    YCGO_at    CARA_at 
#> 0.01159820 0.00781878

For comparison, the raw lasso estimates the BIC search actually selected on:

b_lasso <- coef(search)
sort(abs(b_lasso[b_lasso != 0]), decreasing = TRUE)
#>     YXLE_at     YCGN_at     YPUG_at     TRXA_at        time     XLYA_at 
#> 0.303432404 0.192110417 0.186450402 0.180803453 0.179442561 0.141579883 
#>      GAP_at      ALD_at     PCKA_at     GUAB_at     AHPC_at     YCGO_at 
#> 0.130284277 0.120076949 0.072742341 0.071341414 0.070494407 0.055931403 
#>     YTGA_at     LICA_at     YTGD_at     YUKE_at     NADC_at   DEGQ_r_at 
#> 0.043173113 0.042881936 0.039506127 0.025320276 0.016276191 0.016057183 
#>     XHLA_at     ETFB_at     GLPD_at     CARA_at     YTGB_at 
#> 0.014160253 0.011976966 0.011105405 0.008181430 0.004995659

Interpretation

BIC is flat over the largest lambda values, where no covariate is selected, and changes little until lambda falls to about 0.006. It then drops sharply to its minimum at lambda = 0.005 (23 active covariates: 22 genes and time) and rises again over the next few, smaller values (24 to 27 active covariates). time is selected as a fixed effect, with a negative coefficient, consistent with riboflavin production decreasing over time.

These results differ from Table 5 of Oliveira et al. (2026), which also reports 22 selected genes but retains time only as a random effect; 11 of the 22 genes selected here are among the paper’s. The difference is expected: the paper selects \(\lambda\) by cross-validation at every EM iteration, while this package selects it by BIC over a grid (see ?EMLMLasso).

References

Oliveira DCR, Schumacher FL, Lachos VH (2026). The use of the EM algorithm for regularization problems in high-dimensional linear mixed-effects models. Statistical Methods in Medical Research, 35(2), 240-254. doi:10.1177/09622802251399913

Bühlmann P, Kalisch M, Meier L (2014). High-Dimensional Statistics with a View Toward Applications in Biology. Annual Review of Statistics and Its Application, 1, 255-278.