James W. MacDonald jmacdon at uw.edu
Tue Mar 18 18:51:15 CET 2014

```Hi Magda,

I'm curious. How can one specify a batch using a continuous variable? In
other words, isn't a particular sample in a batch or not?

Best,

Jim

On 3/18/2014 1:44 PM, Magda Price wrote:
> Hi Steve,
>
> Thanks for your advice. I do know that I'm using an old version of R (one
> of the packages I'm using requires it) however, the options you mention
> from sva are in fact available in the older version as well, but it wasn't
> clear to me how to use them.
>
> I've copied the usage and argument information for the ComBat function
> below, maybe you can help clarify:
>
> *ComBat(dat, batch, mod, numCovs=NULL, par.prior=TRUE,prior.plots=FALSE)*
>
> *dat Genomic measure matrix (dimensions probe x sample) - for example,
> expression matrix*
>
> *batch   Batch covariate (multiple batches allowed)*
>
> *mod Model matrix for outcome of interest and other covariates besides
> batch*
>
> *numCovs (Optional) Vector containing the column numbers of the continuous
> covariates in the model matrix, or NULL if no continuous covariates are
> used*
>
> *par.prior (Optional) TRUE indicates parametric adjustments will be used,
> FALSE indicates non-parametric adjustments will be used*
> *prior.plots (Optional) TRUE give prior plots with black as a kernel
> estimate of the empirical batch effect density and red as the parametric
> estimate*
>
> The model matrix is supposed to contain the outcome of interest and other
> covariates *besides batch*, but batch is what I need to be a continuous
> variable. numCovs seems to allow me to specify *covariates* that should be
> continuous, but not *adjustment variables*. What am I missing?
>
> Thanks again!
>
>
>
> On Tue, Mar 18, 2014 at 9:48 AM, Steve Lianoglou
> <lianoglou.steve at gene.com>wrote:
>
>> Hi Magda,
>>
>> You are using a version of R (2.14) that is horribly out of date, and
>> as a result your bioconductor packages are frozen to versions that are
>> quite old.
>>
>> bioconductor packages using biocLite to ensure that you are running
>>
>> The package you are version (sva v3.0.2) is now at version 3.8.0.
>>
>>
>>> - Row would be better treated as a continuous adjustment variable than a
>> factor. In the version of sva that I am using (3.0.2) I believe that only
>> factor adjustment variables are supported. I have seen mention in a few
>> forums that there might be an update to ComBat to adjust for a numeric
>> batch variable, is one available?
>>
>> version of the package:
>>
>>
>> http://bioconductor.org/packages/release/bioc/vignettes/sva/inst/doc/sva.pdf
>>
>> Specifically in Section 7 (Applying the ComBat function to adjust for
>> known batches), where it states:
>>
>> """
>> By default, all adjustment variables will be treated as factor
>> variables by the ComBat function. If you would like to include
>> continuous adjustment variables, also create a vector containing the
>> column numbers of the continuous covariates in the model matrix. This
>> vector must then be input into ComBat via the numCovs option.
>> """
>>
>> HTH,
>>
>> -steve
>>
>> --
>> Steve Lianoglou
>> Computational Biologist
>> Genentech
>>
>
>

--
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099

```