Abstract
Penalization schemes like Lasso or ridge regression are routinely used to regress a response of interest on a high-dimensional set of potential predictors. Despite being decisive, the question of the relative strength of penalization is often glossed over and only implicitly determined by the scale of individual predictors. At the same time, additional information on the predictors is available in many applications but left unused. Here, we propose to make use of such external covariates to adapt the penalization in a data-driven manner. We present a method that differentially penalizes feature groups defined by the covariates and adapts the relative strength of penalization to the information content of each group. Using techniques from the Bayesian tool-set our procedure combines shrinkage with feature selection and provides a scalable optimization scheme.
Abstract
We demonstrate in simulations that the method accurately recovers the true effect sizes and sparsity patterns per feature group. Furthermore, it leads to an improved prediction performance in situations where the groups have strong differences in dynamic range. In applications to data from high-throughput biology, the method enables re-weighting the importance of feature groups from different assays. Overall, using available covariates extends the range of applications of penalized regression, improves model interpretability and can improve prediction performance.
Abstract
Code Availability The software is freely available as an R package https://git.embl.de/bvelten/graper, scripts for the analyses contained in this paper can be found at https://git.embl.de/bvelten/graper_ analyses.
Introduction
We are interested in the setup where we observe a continuous or categorical response Y together with a vector of potential predictors, or features, X ∈ R p and aim to find a relationship of the form Y = f (X).
Introduction
Two main questions are of potential interest in this setting. First, we want to obtain an f that yields good predictions for Y given a new observation X. Second, we aim at finding which components in X are the 'important ones' for the prediction.
Introduction
A common and useful approach to this end are (generalized) linear regression methods, which assume that the distribution of Y |X depends on X via a linear term X T β. In order to cope with high-dimensionality of X and avoid overfitting, penalization on β is employed, e.g. in ridge regression [21] , Lasso [35] or elastic net [46] . By constraining the values of β, the complexity of the model is restricted, resulting in biased but less variable estimates and improved prediction performance. In addition, some choices of the penalty yield estimates with a relatively small number of non-zero components, thereby facilitating feature selection. An example is the L 1 -penalty employed in Lasso or elastic net.
Introduction
Commonly, penalization methods apply a penalty that is symmetric in the model coefficients. Real data, however, often consists of a collection of heterogeneous features, which such an approach does not account for. In particular, it ignores any additional information or structural differences that may be present in the features. Often we encounter X whose components comprise multiple data modalities and data qualities, e.g., measurement values from different assays. Other side-information on individual features could include temporal or spatial information, quality metrics associated to each measurement or the features' sample variance, frequency or signal-to-noise ratio. It has already been observed in multiple testing that the power of the analysis can be improved by making use of such external information (e.g. [22, 15, 13, 26, 25] ). However, in current penalized regression models this information is frequently ignored. Making use of it could on one hand improve prediction performance. On the other hand, it might yield important insight into the relationship of external covariates to the features' importance. For example, if the covariate encodes different data modalities, insights into their relative importance could help cutting costs by reducing future assays to the essential data modalities.
Introduction
As a motivating example we consider applications in molecular biology and precision medicine. Here, the aim is to predict phenotypic outcomes, such as treatment response, and identify reliable disease markers based on molecular data. Nowadays, different high-throughput technologies can be combined to jointly measure thousands of molecular features from different biological layers [32, 19] . Examples include genetic alterations, gene expression, methylation patterns, protein abundances or microbiome occurrences. However, despite the increasing availability of molecular and clinical data, outcome prediction remains challenging [1, 11, 18] . Common applications of penalized regression only make use of parts of the available data. For example, different assay types are simply concatenated or analysed separately. In addition, available annotations on individual features are left unused, such as its chromosomal location or gene set and pathway membership. Incorporating side-information on the assay type and spatial or functional annotations could help to improve prediction performance. Furthermore, it could help prioritizing feature groups, such as different assays or gene sets.
Introduction
Here, we propose a method that incorporates external covariates in order to guide penalization and can learn relationships of the covariate to the feature's effect size in a data-driven way. We introduce the method for linear models and extend it to classification purposes. We demonstrate that this can improve prediction performance and yields insights into the relative importance of different feature sets, both on simulated data and applications in high-throughput biology.
Methods

Problem statement
Assume we are given observations (x 1 , y 1 ), . . . , (x n , y n ) with y i ∈ Y ⊆ R, x i ∈ R p (possibly n p) from a linear model, i.e.
Problem statement
with i iid ∼ N(0, σ 2 ). In addition, we suppose that we have access to a covariate ζ j ∈ Z ⊆ R k for each predictor j = 1, . . . , p. We hope, loosely speaking, that ζ j contains some sort of information on the magnitude of β j . The question we want to address is: Can we use the information from ζ to improve upon estimation of β and prediction of Y ?
Problem statement
In order to estimate β from a finite sample y = (y i ) i=1,...,n ∈ R n and X = [x 1 , . . . , x n ]
Problem statement
T ∈ R n×p we can employ penalization on the negative loglikelihood of the model, i.e. 
Problem statement
where p denotes a penalty function on the model coefficients. For example, p(β) = j |β j | q leads to Lasso (q = 1) or ridge regression (q = 2). The parameter λ controls the amount of penalization and thereby the model complexity. Ideally, we would like to choose an optimal λ. For estimation this means minimizing the mean squared error MSE(β(λ)) = E||β(λ) − β|| 2 2 ; for prediction this means minimizing the expected prediction error. In practice, λ is often chosen to minimize the cross-validated error.
Problem statement
In most applications, the penalization is symmetric, i.e. for any permutation π we have λp(β 1 , . . . , β p ) = λp(β π(1) , . . . , β π(p) ). However, as we have external information on each feature given by ζ we want to allow for differential penalization guided by ζ. For this, we will consider the following non-symmetric generalization, which still leads to a convex optimization problem in β for convex penalty functionsp, such asp(x) = |x| orp(x) = x 2 :
Problem statement
β(λ) ∈ arg min
Problem statement
Instead of a constant λ, here λ : Z → R ≥0 provides a mapping from the covariate ζ to a non-negative penalty factor λ(ζ). This additional flexibility compared to a single penalty parameter can be helpful if ζ contains information on β. For example, in the simple case of ridge regression with deterministic orthonormal design matrix, known noise variance σ 2 and 'oracle covariate' ζ j = β j the optimal λ is seen to be λ * (ζ j ) = . However, in practice the information in ζ is not that explicit and hence we do not know which λ is optimal.
Problem statement
If λ takes values in a small set of discrete values, e.g. for categorical covariates ζ, cross-validation could be used to determine a suitable set of function values. This approach is employed in [6] , where categorical covariates encode different data modalities. However, cross-validation soon becomes prohibitive, as it requires a grid search exponential in the number of categories defined by ζ. Similarly, cross-validation can be employed with λ parametrized by a small number of tuning parameters using domain knowledge to come up with a suitable parametric form for λ [3, 38] . However, such an explicit form is often not available. In many situations it is a major problem itself to come up with a helpful relationship between ζ and β and thereby knowledge of which values of a covariate would require more or less penalization. Therefore, we aim at finding λ in a data-driven manner and with improved scalability compared to cross-validation.
Problem statement from a Bayesian perspective
There is a direct correspondence between estimates obtained from penalized regression and a Bayesian estimate with penalization via corresponding priors on the coefficients. For example, the ridge estimate corresponds to the maximum a posterior estimate (MAP) in a Bayesian regression model with normal prior on β and the Lasso estimate to a MAP with a Laplace prior on β. This correspondence opens up alternative strategies using tools from the Bayesian mindset to approach the problem outlined above: Differential penalization translates to introducing different priors on the components of β. Our belief that ζ carries information on β can be incorporated by using prior distributions whose parameters depend on ζ. In [39] , the authors used this idea to derive an Empirical Bayes approach for finding group-wise penalty parameters in ridge regression. However, this approach does not obviously generalize to other penalties such as the Lasso.
Problem statement from a Bayesian perspective
Moving completely into the Bayesian mindset we instead turn to explicit specification of priors to implement the penalization task. Different priors have been suggested [30, 31, 29, 10] and structural knowledge was incorporated into the penalization by employing multivariate priors that encode the structure in the covariance or non-exchangeable priors with different hyper-parameters (e.g. [42, 41, 2, 20, 33, 20, 14] and references therein). Despite the possible gains in prediction performance when incorporating such structural knowledge, these methods have not been widely applied. A limiting factors has often been the lack of scalability to large data sets.
Setup and notation
From the linear model assumption we have
Setup and notation
where τ denotes the precision of the noise. Based on the external covariate ζ we define a partition of the p predictors into G groups:
Setup and notation
For instance, categorical covariates ζ, such as different assay types, naturally define such a partition. For continuous covariates g ζ can be defined based on suitable binning or clustering. To achieve penalization in dependence of ζ we consider a spike-and-slab prior [30] on the model coefficients β with a different slab precision γ and mixing parameter π for each group. We re-parametrize β as β j = s j b j with
Setup and notation
In the special case of π = 1 this yields a normal prior as in [29] corresponding to ridge regression. With π < 1 we additionally promote sparsity on the coefficients, and the value of π controls the number of active predictors in each group. The value of γ controls the overall shrinkage per group. To learn the model hyperparameters γ, π and the noise precision τ , we choose the following conjugate priors
Setup and notation
and for each group k ∈ {1, . . . , G}
Setup and notation
with d τ , r τ , d γ , r γ = 0.001 and r π , d π = 1. Hence, the joint probability of the model is given by
Inference using Variational Bayes
The challenge now lies in inferring the posterior of the model parameters from the observed data X, y and the covariate ζ. While Markov Chain Monte Carlo methods are frequently used for this purpose they do not scale well to large data sets. Here, we adopt a variational inference framework [5, 4] that has been used (in combination with importance sampling) for variable selection with exchangeable priors [8, 9] . Denoting all unobserved model components by θ = (b, s, γ, π, τ ), we approximate the posterior p(θ|X, y) by a distribution q(θ) from a restricted class of distributions Q, where the goodness of the approximation is measured in terms of the Kullback-Leibler (KL) divergence, i.e.
Inference using Variational Bayes
A common and useful choice for distributions in class Q is the mean-field approximation, i.e. that the distribution factorizes in its parameters. We consider
Inference using Variational Bayes
where b i and s i are not factorised due to their strong dependencies [37] . The variational approach leads to an iterative inference algorithm [5] by observing that minimizing the KL-divergence is equivalent to maximizing the evidence lower bound L defined by
Inference using Variational Bayes
From this, we have
Inference using Variational Bayes
with H(q) = −q(θ) log q(θ) dθ denoting the differential entropy. Variational methods are based on maximisation of the functional L with respect to q in order to obtain a tight lower bound on the log model evidence and minimize the KL-distance between the density q and the true (intractable) posterior. Under a mean-field assumption q(θ) = j q(θ j ), the optimal q j keeping all other factors fixed is given by
Inference using Variational Bayes
Iterative optimization of each factor results in Algorithm 1. Details on the variational inference and the updates can be found in Appendix A.1 and A.2. The method is implemented in the freely available R package graper. From the obtained approximation q of the posterior distribution, we obtain point estimates for the model parameters. In particular, we will use the posterior meansβ = β q(β) dβ,γ = γ q(γ) dγ andπ = π q(π) dπ.
Algorithm 1 Inference algorithm
1: Input: X, y,
Algorithm 1 Inference algorithm
while L(q) has not converged do:
Algorithm 1 Inference algorithm
Set q(τ ) = Γ(τ |α τ , β τ ) with for k = 1, . . . G do 10:
Algorithm 1 Inference algorithm
Calculate L(q) = E log p(y, b, s, γ, π, τ ) + H(q) Notes: The expectations are taken under the current variational distribution q, and H(q) = −q(θ) log q(θ)dθ denotes the differential entropy. We use F(x|a) to denote the probability density function in x of a distribution F with parameters a, e.g. Beta(x|α, β). In step 7 it is important to keep track of v = X Eβ in the implementation to obtain linear computational complexity in p. We set r τ = r γ = d τ = d γ = 0.001 and d π = r π = 1.
Algorithm 1 Inference algorithm
Remark on the choice of the mean-field assumption An interesting deviation from the standard fully factorized mean-field assumption in Equation (13) is taking a multivariate variational distribution for the model coefficients. This is easily possible for the dense model (π = 1, s = 1, b = β), where we can consider the factorization q(β, γ, τ ) = q(β)q(γ)q(τ ).
Algorithm 1 Inference algorithm
In particular, a multivariate distribution is kept for the model coefficients β instead of factorizing q(β) = i q(β i ). Thereby, this approach allows to capture dependencies between model coefficients in the inferred posterior and is less approximative. We will show below that this can improve the prediction results. However, a drawback of this approach is its computational complexity, as it requires the calculation and inversion of a p × p covariance matrix in each step. While this can be reduced to a quadratic complexity as described in Appendix A.2.1, this is still prohibitive for many applications. Therefore, we concentrate in the following on the fully factorized mean-field assumption but include comparisons to the multivariate approach in the Results.
Extension to logistic regression
The model of Section 2.3 can be flexibly adapted to other types of generalised linear regression setups with suitable link functions and likelihoods. However, the inference framework needs to be adapted due to loss of conjugacy. Here, we extend the model to the framework of logistic regression with a binary response variable, where we assume that the response follows a Bernoulli likelihood with a logistic link function
Extension to logistic regression
While the prior structure and core of the variational inference are identical to the case of a linear model, additional approximations are necessary. For this purpose we adopt [23] and approximate the likelihood using a lower bound on the logistic function. For an arbitrary ξ ∈ R we have
Extension to logistic regression
with
Extension to logistic regression
As this approximation restores a quadratic form in β, the remaining updates can be adopted from the case of a linear model above with the additional variational parameter ξ (see Appendix A.2.2 for details).
Results

Results on simulated data
First, we evaluated the method on simulated data to test its ability to recover the model coefficients and hyper-parameters per group. For this, a random X matrix was generated from a multivariate normal distribution with mean zero and a Toeplitz covariance structure Σ ij = ρ |i−j| , and the response was simulated from a linear model with normal error. The p predictors were split into G = 6 groups of equal size, and the coefficients were simulated from the model as described in Equations (6) and (7) with fixed π k and γ k for each group. In particular, we set γ k = 0.01 for k = 1, 2, γ k = 1 for k = 3, 4 and γ k = 100 for k = 5, 6. For each pair of groups with same γ-value the sparsity level π k was varied between ν and min(1, 1.5ν) for a certain value of ν determining the sparsity level from 0 (sparse) to 1 (dense). We then varied the number of features p, the number of samples n, the correlation strength ρ, the noise precision τ and the sparsity level ν (Table 1 ) and generated for each setting ten independent data sets. We evaluated the recovery of the hyper-parameter γ and π for each group and compared the predictive performance and computational complexity to those of related methods including ridge regression [21] , Lasso [35] , elastic net [46] , adaptive Lasso [45] , sparse group Lasso, group Lasso [16] , GRridge [39] , varbvs [9] and IPF-Lasso [6] . Table 1 : Simulation parameters: p denotes the number of features, n the number of samples, ρ the correlation strength in X, τ the noise precision and ν the sparsity level.
Recovery of hyper-parameters
The algorithm accurately recovered the relative importance of different groups (encoded by γ k ) and the group-wise sparsity level (encoded by π k ) across a large range of settings as shown in Figure 1 . The method failed to recover those parameters accurately only if the ratio between sample size and number of features was too small or the sparsity parameter ν was too close to 1. These settings were challenging for all methods as can be seen in Section 3.1.2, where we evaluated estimation and prediction performance in comparison to other methods. In addition, the groups had to contain sufficiently many predictors to reliably estimate group-wise parameters, as seen in Figure 1 (b). We also noted that a low signal-to-noise ratio could impede the estimation of hyperparameters q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q as can be seen from the group with a very large γ value (meaning low coefficient amplitudes as in group 5 and 6) and low precision values (τ ) of the noise term.
Prediction and estimation performance
Next, we compared the estimation of the true model coefficients and the prediction accuracy on an independent test set of n = 1000. Overall, the method showed improved performance for a large range of sample sizes, correlations, numbers of features, noise variances and active features, both in terms of the root mean squared error on y as well as for estimation of β (Figure 2 ). Among the nonsparse methods graper with a non-factorized mean-field assumption clearly outperformed the factorized mean-field assumption as well as GRridge and group Lasso. The covariate-agnostic ridge regression performed worst in most cases.
Prediction and estimation performance
Sparse methods performed in general better in this simulation example, as the underlying model had a large fraction of zero coefficients. Here, we observed that graper was comparable to IPF-Lasso, which is the most closely related method. Only in settings with a very high number of active predictors or strong correlations between the predictors (ρ close to one) the method was outperformed by the IPF-Lasso.
Scalability
While the additional group-wise optimization comes at a computational cost, the variational approach runs inference in time complexity linear in the number of features p, samples n and groups G. Only in the case of a multivariate variational distribution, the complexity is quadratic in the larger of n and p and cubic in the smaller of the two. When varying the number of samples n, features p and groups G we observed comparable run times as for Lasso ( Figure  3 ). Differences were mainly observed for p: For larger p, graper required slightly longer times than Lasso. This difference was more pronounced when using a sparsity promoting spike and slab prior, where additional parameters need to be inferred. As expected, the multivariate approach of graper became considerably slower for large p and showed comparable run times to the sparse group Lasso. The number of groups mainly influenced the computation times of IPF-Lasso, which scales exponentially in the number of groups. Here, graper provided a by far more scalable approach.
Application to data from high-throughput biology

Drug response prediction in leukaemia samples
Next, we exemplify the method's performance on real data by considering an application to biological data, where predictors were obtained from different assays. Using assay type as external covariates we used the method to integrate data from the different assays (also referred to as omic types) in a study on chronic lymphocytic leukaemia (CLL) [12] . This study combined drug response measurements with molecular profiling including gene expression and methylation. Briefly, we used normalized RNA-Seq expression values of the 5000 most variable genes, the DNA methylation M-values at the 1% most variable CpG sites as well as the ex-vivo cell viability after exposure to 61 drugs at 5 different concentrations as predictors for the response to a drug (Ibrutinib) that was not included into the set of predictors. In total, this resulted in a model with n = 121 patient samples and p = 9, 553 predictors. We first applied the different regression methods to the data on their original scale. Since the features have different scales (e.g., the drug responses vary from around 1 (neutral) to 0 (completely toxic), the normalized expression values from 0 to 20 and the methylation M-values from -10 to 8), this ensures that the omic type information is an informative covariate: It results in larger effect sizes of (left) and the estimateβ (right) for different methods when varying one of the simulation parameters (a-e) as described in Table 1 . The prediction error is assessed on n = 1000 test samples. The line denotes the mean RMSE across 10 random instances of simulated data with bars denoting standard errors. The two panels separate methods with sparse estimates of β (right) from non-sparse methods (left). (Group Lasso is counted as non-sparse method as it is not sparse within groups.) the drug response data and smaller effect sizes of the methylation and expression data compared to scaled predictors. In this setting, incorporating knowledge on the assay type into the penalized regression showed clear advantages in terms of prediction performance: The covariate-aware methods (GRridge, IPF-Lasso and graper) all improved upon the covariate-agnostic Lasso, ridge regression or elastic net (Figure 4(a) ). Also the group Lasso methods, which incorporate the group information but apply a single penalty parameter, could not adapt to the scale differences. The inferred hyper-parameters γ of graper highlighted the larger effect sizes of the drug response feature group, which was strongly favoured by the penalization (Figure 4(b) ). To address differences in feature scale, a common choice made by many implementations (e.g., glmnet [17] ) is to scale all features to unit variance. Indeed, for the data at hand, this transformation was particularly beneficial for the covariate-agnostic methods, and their prediction performances became more similar to those of the covariate-aware methods. However, for dense methods such as ridge regression the covariate information on the omic type remained important ( Figure 5(a) ). Sparse methods in general resulted in very good predictions as the response to Ibrutinib can be well explained by a very sparse model containing only few drugs with related mode of action. By learning weights for each omic type graper directly highlighted the importance of the drug data as predictors ( Figure 5(b) ).
Drug response prediction in leukaemia samples
In general, standardization of all features is unlikely to be an optimal choice, since in many applications there is a relation between information content and amplitude. Here, standardization would drown informative high-amplitude features and 'blow up' noisy low-amplitude features (see Appendix A.3.1). 
Age prediction from multi-tissue gene expression data
As a second example for a covariate in genomics we considered the tissue type. Using data from the GTEx consortium [27] we asked whether the tissue type is an informative covariate in the prediction of a person's age from gene expression. Briefly, we chose five tissues that were available for the largest number of donors and from each tissue considered the top 50 principal components on the RNA-Seq data after normalization and variance stabilization [28] . In total, this gave us p = 250 predictors from G = 5 tissues for n = 251 donors. We observed a small advantage for methods that incorporate the tissue type as a covariate (Figure 6(a) ): GRridge, IPF-Lasso and graper all had a smaller prediction error compared to covariate-agnostic methods. In particular, graper resulted in comparable prediction performance to IPF-Lasso whilst requiring less than a second for training compared to 40 minutes for IPF-Lasso. The learnt relative penalization strength and sparsity levels of graper can again provide insights into the relative importance of the different tissue types. In particular, we found lower penalization for blood vessel and muscle and higher penalization for blood and skin ( Figure 6(b) ). This is consistent with previous studies on a per-tissue basis, where gene expression in blood vessel has been found to be a good predictor for age, while blood was found to be less predictive [43] .
Discussion
We propose a method that can use information from external covariates to guide penalization in regression tasks and that can provide a flexible and scalable alternative to approaches that were proposed recently [39, 6] . We illustrated in simulations and data from biological applications that if the covariate is informative of the effect sizes in the model, these approaches can improve upon commonly used penalized regression methods that are agnostic to such information. We investigated the use of important covariates in genomics such as omic type or tissue. The performance of our approach is in many cases comparable to the IPF-Lasso method [6] , while scalability is highly improved in terms of the number of feature groups, thereby extending the range of possible applications.
Discussion
The variational inference framework provides improved scalability compared to Bayesian methods that are based on sampling strategies. Variational Bayes methods have already been employed in the setting of Bayesian regression with Spike-and-Slab priors [8, 9] . However, these methods do not incorporate information from external covariates. A drawback of variational methods are too concentrated approximations to the posterior distribution. Nevertheless, they have been shown to provide reasonable point estimates in regression tasks [8] , which we focused on here. Due to the mean-field assumption strong correlations between active predictors can lead to suboptimal results of graper. Here, a multivariate mean-field assumption in the variational Bayes approach can be of advantage, suggested as an alternative above. However, it comes at the price of higher computational costs. What is not addressed in our current implementation is the common problem of missing values in the data; if extant, they would need to be imputed beforehand. While our approach is related to methods that adapt the penalty function in order to incorporate structural knowledge, such as the group Lasso [44] , sparse group Lasso [16] or fused Lasso [36] , these approaches apply the same penalty parameter to all the different groups and perform hard in-or exclusion of groups instead of the softer weighting proposed here. Alternatively, the loss function can be modified to incorporate prior knowledge based on a known set of 'high-confidence predictors' as in [24] . The existence and identity of such 'high-confidence predictors', however, is often not clear.
Discussion
In contrast to frequentist regression methods, the Bayesian approach provides direct posterior-inclusion probabilities for each feature that can be useful for model selection. To obtain frequentist guarantees on the selected features it could be promising to combine the approach with recently developed methods for controlling the false discovery rate (FDR), such as the knockoffs [7] . For this, feature statistics can be constructed based on the estimated coefficients or inclusion probabilities from our model as long as the knockoffs obtain the same covariate information as their true counterpart.
Discussion
An interesting question that we have not addressed is the quest for rigorous criteria when the inclusion of a covariate by differential penalization is of advantage. This question is not limited to the framework of penalised regression but affects the general setting of shrinkage estimation. While joint shrinkage of a set of estimates can be very powerful in producing more stable estimates with reduced variance, care needs to be taken on which measurements to combine in such a shrinkage approach. As in the case of coefficients in the linear model setting, external covariates could be helpful for this decision and facilitate a more informed shrinkage. However, allowing for differential shrinkage will re-introduce some degrees of freedom into the model and can only be advantageous if the covariate provides 'sufficient' information to balance this. For future work, it would be of interest to find general conditions for when this is the case, thereby enabling an informed choice of covariates in practice.
Discussion
We provide an open-source implementation of our method in the R package graper. In addition, vignettes and scripts are made available that facilitate the comparison of graper with various related regression methods and can be used to reproduce all results contained in this work.
Discussion
Supplementary Materials In Appendix A.1 of the Supplementary Materials we provide details on variational inference. Details on the update equations for the proposed methods can be found in Appendix A.2. In Appendix A.3 of the Supplementary Materials we discuss practical considerations for the training.
A Appendix
Here we provide details on the variational inference scheme, the updates in our model and practical considerations for training. As before, X denotes the n × p matrix of observed predictors and y the n-vector of observed response values. With X ij we denote the (i, j)-th element of the matrix X and X ·,j its j-th column. Furthermore, y i ∈ R denotes the i-th response value and x i ∈ R p the i-th predictor vector, corresponding to the i-th row in X. We will use E = E q to denote expectations with respect to the variational distribution q.
A.1 Variational inference
To arrive at a simple iterative algorithm, we make use of the following lemma, which provides an update rule for each factor in the variational distribution [5] .
A.1 Variational inference
Lemma 1 Under the mean-field assumption and for a fixed j the evidence lower bound defined in Equation (14) is maximised by
A.1 Variational inference
where the expectation is taken under the current variational distribution l =j q(θ l ).
A.1 Variational inference
This can be easily seen by writing
A.1 Variational inference
Hence, after normalising, the distribution q * i (θ i ) is given by
A.2 Update equations for the variational inference

A.2.1 Linear regression model
In the linear model we assume that the likelihood is given by
A.2.1 Linear regression model
With the priors as described in Section 2.3 and again denoting β = sb the joint distribution is given by
A.2.1 Linear regression model
Hence,
A.2.1 Linear regression model
The dense model without the spike and slab component arises as a special case when dropping π and s from the model and setting β = b. For the start we will make a full mean-field assumption, i.e.
A.2.1 Linear regression model
allowing only a joint distribution for (b j , s j ) due to their strong dependencies [37] . Denoting with θ all individual parameter components in the mean-field assumption, the updates are given by log(q j (θ j )) = E −j log(p(y, θ)), as shown above (Lemma 1). Thanks to conjugacy between the chosen priors and the likelihood these updates maintain the distributional family of θ j reducing the inference to updates of their parameters in each step. Explicitly, this leads to the following updates in step l:
A.2.1 Linear regression model
Updates for β (b and s) For β one notes
A.2.1 Linear regression model
This can be written as
A.2.1 Linear regression model
where
A.2.1 Linear regression model
To make this scale linearly in p in the inner loop we follow [8] and keep track of v = Xµ and update this only in the new component
A.2.1 Linear regression model
The marginal distribution of s j is given by s j ∼ Ber(ψ
A.2.1 Linear regression model
This is derived by integrating the joint density of q(b j , s j ) to obtain the marginal
A.2.1 Linear regression model
) are independent gamma distributions with parameters in step l given by
A.2.1 Linear regression model
Updates for τ
A.2.1 Linear regression model
) is a gamma distribution with parameters in step l given by
A.2.1 Linear regression model
Updates for π = (π 1 , . . . , π G )
A.2.1 Linear regression model
) are independent beta distributions with parameters in step l given by
A.2.1 Linear regression model
Expected values required The updates above involve the calculation of expected values under the current variational distribution q. These are given by
A.2.1 Linear regression model
Here, ψ denotes the digamma function ψ(x) = Γ (x) Γ(x) and
A.2.1 Linear regression model
Note that here and in the following we dropped the step index (l) of all parameters from the notation for simplicity.
Calculation of the Evidence Lower Bound
The evidence lower bound bounds the log model evidence from below and can be calculated in each step to monitor convergence. Recall
Calculation of the Evidence Lower Bound
Γ(a+b) denoted the beta function. The required expectations in addition to those used in the updates are easily obtained using the known distributions and parameters of the variational density in each iteration and the fact that q factorizes, i.e. E log(τ ) = ψ(α τ ) − log(β τ ), Eτ ||y − X(b s)|| 
A.2.2 Logistic regression model
In order to adapt the model to binary data, we change the likelihood of y to a Bernoulli distribution and consider a generalized linear model with logistic link function, i.e. .
A.2.2 Logistic regression model
The priors on the model coefficients β remain the same as in the linear model, the noise variance τ is dropped from the model. While the model is strongly related to the case of the normal response variable, the challenge here lies in the fact that with the Bernoulli distribution for Y we loose the conjugacy of the prior from the linear model. To solve this and still obtain a fast and explicit inference scheme, we use an approximation of the sigmoid function by an exponential of a quadratic term, thus restoring conjugacy.
A.2.2 Logistic regression model
As σ(−a) = 1 − σ(a) we can write P(y i = 1|β) = σ(x Following [23] we use the following lower bound on the sigmoid
A.2.2 Logistic regression model
This introduces an additional variational parameter ξ, which we update alongside the other updates to improve this approximation in each iteration. Using this approximation we can bound the joint density of the model by with D = diag( (Eγ g(j) ) j=1,...,p ).
A.2.2 Logistic regression model
Relationship to the linear model Note that the analogy to the linear update becomes explicit, when interpreting Equation (21) as a normal density on pseudo-data [34] defined byỹ i = 2y i − 1 4η(ξ i ) .
A.2.2 Logistic regression model
Then it can be easily seen that log h(β, ξ) = log p(ỹ|β) + c(ξ),
A.2.2 Logistic regression model
Replacing the precision parameter τ in the linear case with the precision of the pseudo-data (which is now sample-specific) can give us above updates directly from the linear model.
A.2.2 Logistic regression model
Update for the variational parameter ξ The update of the variational parameter ξ is given following [23] by
A.2.2 Logistic regression model
which can be restricted to non-negative values of ξ due to the symmetry.
A.2.2 Logistic regression model
Evidence lower bound As before L(q) = E q (log p(y, b, s, γ, π))
A.2.2 Logistic regression model
H(q(b i , s i )) + H(q(γ)) + H(q(π)).
A.2.2 Logistic regression model
The entropies can be calculated as in the linear model with the respective parameters of the variational distributions. The terms from the joint model density only differ in the first term E q log p(y, b, s, γ, π) = E q log p(y|b, s) + E q log p(b|γ) + E q log p(s|π) + E q log p(γ) + E q log p(π), which here is given by E q log p(y|β) = E q log σ((2y − 1)Xβ)
A.2.2 Logistic regression model
This provides a lower bound on the evidence lower bound in analogy to the linear model that is used to monitor convergence.
A.3 Practical considerations

A.3.1 Standardization of the predictors
In penalised regression a common preprocessing step is the standardization of all predictors to unit variance to ensure a presumably 'fair' penalty. This scaling is in 1:1 correspondence to differential penalty factors. Without standardization features on a larger scale would be preferred as they need a smaller coefficient relative to a feature with the same effect but measured on a smaller scale. However, standardization can be suboptimal as it does not distinguish between meaningful differences in variance (e.g. features that differ between two disease groups) and differences in variance due to the scale. While removal of the latter would be desirable, meaningful differences should be retained. For example, in many applications we measure high-amplitude signals that are informative jointly with low-amplitude features that originate mainly from technical noise. Here, standardization can be harmful ( Figure 7) . Hence, the question of whether to scale the predictors or not, is related to the question of whether the variance of a feature is an informative covariate. By default, our method standardizes all features. However, if we want to maintain the difference of variances within each assay, our method can adaptively learn scale differences between assays by γ, thereby removing the need to standardize for adjustment between assays as seen in the CLL application. This could help to retain meaningful differences in the features' variance within one assay. Alternatively, it is also possible to standardize features but re-include information on their variance via the covariate, e.g., binning features based on their variance. A recent study on RNA-Seq data found no strong effect of standardization compared to no standardization [47] . Depending on the data set at hand it might, however, make sense to retain the original scale. For example with binary mutation data, where features are all on the same scale, standardization would favour mutations with lower frequencies. A number of p = 600 features was simulated from a standard normal distribution and multiplied by 10 (high-amplitude features, p = 300) or 1 (lowamplitude features, p = 300). The response was simulated from a normal model with coefficients given by 1 for the high-amplitude features and 0 otherwise. Lasso and ridge regression were fitted on a training set of n = 500 samples using either standardized predictors (blue) or predictors on the original scale (green). The resulting fits were evaluated in terms of the root mean squared error (RMSE) on an independent test set of n = 500 samples. The boxplots were obtained from ten independent instances of simulated data.
A.3.2 Modelling an intercept
To include an intercept into the model, we apply centering of X and y before model fitting in the case of a linear model. For the logistic model this is not as straightforward and we follow [8] in the implementation, i.e. the intercept is β 0 is assumed to have a normal prior N(0, σ 2 0 ) but considering the limiting case for σ 0 to infinity yielding an improper prior (essentially not penalizing the intercept).

{'paper_id': '88524192', 'title': 'Adaptive penalization in high-dimensional regression and classification with external covariates using variational Bayes', 's2_url': 'https://api.semanticscholar.org/CorpusID:88524192', 'source': 'S2ORC'}