Running ComBat Without a Batch Argument to Correct for Continuous, Numeric Covariates
3
0
Entering edit mode
JMallory • 0
@jmallory-13488
Last seen 2.3 years ago

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. 

combat sva • 1.1k views
ADD COMMENT
1
Entering edit mode
@peter-langfelder-4469
Last seen 12 months ago
United States

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 COMMENT
0
Entering edit mode

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 REPLY
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode
@gordon-smyth
Last seen 1 hour ago
WEHI, Melbourne, Australia

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 COMMENT
0
Entering edit mode
@w-evan-johnson-5447
Last seen 16 months ago
United States

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 COMMENT

Login before adding your answer.

Traffic: 289 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6