# batchQC_sva: Estimate the surrogate variables using the 2 step approach... In BatchQC: Batch Effects Quality Control Software

## Description

Estimate the surrogate variables using the 2 step approach proposed by Leek and Storey 2007

## Usage

 `1` ```batchQC_sva(data.matrix, modmatrix) ```

## Arguments

 `data.matrix` Given data or simulated data from rnaseq_sim() `modmatrix` Model matrix for outcome of interest and other covariates besides batch

## Value

Surrogate variables analysis object

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```nbatch <- 3 ncond <- 2 npercond <- 10 data.matrix <- rnaseq_sim(ngenes=50, nbatch=nbatch, ncond=ncond, npercond= npercond, basemean=10000, ggstep=50, bbstep=2000, ccstep=800, basedisp=100, bdispstep=-10, swvar=1000, seed=1234) batch <- rep(1:nbatch, each=ncond*npercond) condition <- rep(rep(1:ncond, each=npercond), nbatch) pdata <- data.frame(batch, condition) modmatrix = model.matrix(~as.factor(condition), data=pdata) batchQC_sva(data.matrix, modmatrix) ```

### Example output

```sh: 1: cannot create /dev/null: Permission denied
Number of significant surrogate variables is:  1
Iteration (out of 5 ):1  2  3  4  5  \$sv
[,1]
[1,] -0.194801306
[2,] -0.135803229
[3,] -0.168102438
[4,] -0.195893961
[5,] -0.157234835
[6,] -0.166325086
[7,] -0.178687003
[8,] -0.194536306
[9,] -0.154218339
[10,] -0.210004194
[11,] -0.125162543
[12,] -0.130228593
[13,] -0.110571942
[14,] -0.101355885
[15,] -0.107303860
[16,] -0.157762934
[17,] -0.117848917
[18,] -0.144030243
[19,] -0.127224634
[20,] -0.122600103
[21,] -0.001837603
[22,] -0.062355061
[23,] -0.033206513
[24,] -0.010265321
[25,] -0.034427045
[26,] -0.073212397
[27,] -0.024181836
[28,] -0.007421213
[29,] -0.054375573
[30,] -0.019854144
[31,] -0.026386457
[32,]  0.027567713
[33,]  0.044343297
[34,]  0.039471668
[35,]  0.031944616
[36,]  0.034324079
[37,]  0.033579461
[38,] -0.006713468
[39,]  0.002630184
[40,]  0.014532755
[41,]  0.117428472
[42,]  0.154163432
[43,]  0.097791612
[44,]  0.124792312
[45,]  0.156850573
[46,]  0.141980797
[47,]  0.127439722
[48,]  0.141470330
[49,]  0.111287768
[50,]  0.144318062
[51,]  0.175314031
[52,]  0.179850496
[53,]  0.189822056
[54,]  0.168122173
[55,]  0.189444498
[56,]  0.185447601
[57,]  0.204992325
[58,]  0.159247480
[59,]  0.170813916
[60,]  0.184961553

\$pprob.gam
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[39] 1 1 1 1 1 1 1 1 1 1 1 1

\$pprob.b
[1] 0.212918200 0.000000000 0.000000000 0.000000000 0.905848672 0.000000000
[7] 0.000000000 0.696939870 0.285421303 0.000000000 0.000000000 0.000000000
[13] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
[19] 0.000000000 0.000000000 0.000000000 0.455706618 0.663173487 0.000000000
[25] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.769066799
[31] 0.000000000 0.000000000 0.000000000 0.430393665 0.000000000 0.206309527
[37] 0.637684530 0.000000000 0.000000000 0.000000000 0.000000000 0.650192142
[43] 0.000000000 0.008851306 0.776906089 0.240580208 0.618714464 0.000000000
[49] 0.000000000 0.000000000

\$n.sv
[1] 1
```

BatchQC documentation built on Nov. 8, 2020, 8:30 p.m.