Search
Question: Running ComBat Without a Batch Argument to Correct for Continuous, Numeric Covariates
0
gravatar for JMallory
3 months ago by
JMallory0
JMallory0 wrote:

Is there a way to use ComBat to return a data matrix adjusted by only numeric covariates? As implemented in SVA, ComBat allows for adjustment of data by numeric covariates, but only if a batch effect (i.e., a factor variable) is also provided. What if I just want to "clean" a data matrix of several continuous, numeric nuisance variables (e.g., surrogate variables as identified by SVA)? Specification of the nuisance variables in a linear model is not possible, as I am attempting to apply k-means clustering to the data. 

ADD COMMENTlink modified 3 months ago by W. Evan Johnson730 • written 3 months ago by JMallory0
1
gravatar for Peter Langfelder
3 months ago by
United States
Peter Langfelder1.4k wrote:

To my knowledge, there's no way to use ComBat to adjust for continuous variables. The WGCNA package (over on CRAN) has an implementation of Empirical Bayes-moderated linear model regression (function empiricalBayesLM) that works with either continuous or categorical variables but unlike ComBat, it does not do anything with the variances. If you are a ComBat user, do note that there are some differences between the arguments to ComBat and to empiricalBayesLM, especially the row and column interpretation of the input and output data.

ADD COMMENTlink modified 3 months ago • written 3 months ago by Peter Langfelder1.4k

Peter, I have used WGCNA in the past, but was unaware of this function. As per its description in the documentation, it does exactly what I have been trying to get at for the past few weeks. Criminally underappreciated bit of code. Thank you.  

ADD REPLYlink written 3 months ago by JMallory0
1

It is a relatively new function, and it was not widely (in fact, at all) advertised.

ADD REPLYlink written 3 months ago by Peter Langfelder1.4k
0
gravatar for Gordon Smyth
3 months ago by
Gordon Smyth32k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth32k wrote:

As already noted, you can't do that in ComBat. An alternative is removeBatchEffect() in the limma package, which will remove effects for one or more continuous variables.

ADD COMMENTlink modified 3 months ago • written 3 months ago by Gordon Smyth32k
0
gravatar for W. Evan Johnson
3 months ago by
United States
W. Evan Johnson730 wrote:

Yes, Gordon and others are correct. ComBat can handle continuous covariates, but cannot handle continuous batch variables. ComBat assumes you are giving a discrete batch variable as input, and sets up indicator variables for each level of the given batch variable. So if you gave a continuous vector, it would make indicator variables for each level in your vector.

However, if needed, the ComBat code could easily be hacked to do what you want--i.e. just skip the indicator variable setup step. Send me a personal message if you would like some help on this. 

Evan 

ADD COMMENTlink written 3 months ago by W. Evan Johnson730
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 105 users visited in the last hour