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