Description Usage Arguments Value Examples
Performs test to check whether batch needs to be adjusted
1 |
pca |
PCA object from principal component analysis |
batch |
Batch covariate |
mod |
Model matrix for outcome of interest and other covariates besides batch |
Summary of linear regression of first five principal components
1 2 3 4 5 6 7 8 9 10 11 12 | 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)
pca <- batchqc_pca(data.matrix, batch, mod=modmatrix)
batchtest(pca, batch, mod=modmatrix)
|
sh: 1: cannot create /dev/null: Permission denied
Call:
lm(formula = pc[, 1] ~ fbatch + fcond)
Residuals:
Min 1Q Median 3Q Max
-1.95358 -0.45328 0.04717 0.60252 1.57878
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -7.4258 0.2051 -36.20 <2e-16 ***
fbatch2 5.9121 0.2512 23.53 <2e-16 ***
fbatch3 12.5239 0.2512 49.85 <2e-16 ***
fcond1 2.5608 0.2051 12.48 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.7945 on 56 degrees of freedom
Multiple R-squared: 0.9793, Adjusted R-squared: 0.9781
F-statistic: 881.1 on 3 and 56 DF, p-value: < 2.2e-16
Call:
lm(formula = pc[, 2] ~ fbatch + fcond)
Residuals:
Min 1Q Median 3Q Max
-3.7975 -0.6522 0.1296 0.7709 2.8918
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.09594 0.32455 0.296 0.769
fbatch2 -0.43845 0.39749 -1.103 0.275
fbatch3 -0.07704 0.39749 -0.194 0.847
fcond1 0.15179 0.32455 0.468 0.642
Residual standard error: 1.257 on 56 degrees of freedom
Multiple R-squared: 0.02788, Adjusted R-squared: -0.0242
F-statistic: 0.5354 on 3 and 56 DF, p-value: 0.66
Call:
lm(formula = pc[, 3] ~ fbatch + fcond)
Residuals:
Min 1Q Median 3Q Max
-4.6201 -0.6683 0.2035 0.6785 2.6077
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.339994 0.300463 1.132 0.26264
fbatch2 -0.001188 0.367990 -0.003 0.99744
fbatch3 0.195881 0.367990 0.532 0.59663
fcond1 -0.809783 0.300463 -2.695 0.00927 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.164 on 56 degrees of freedom
Multiple R-squared: 0.1201, Adjusted R-squared: 0.07296
F-statistic: 2.548 on 3 and 56 DF, p-value: 0.06497
Call:
lm(formula = pc[, 4] ~ fbatch + fcond)
Residuals:
Min 1Q Median 3Q Max
-3.3476 -0.7101 -0.0702 0.6425 2.4201
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.23142 0.29813 -0.776 0.441
fbatch2 0.39746 0.36513 1.089 0.281
fbatch3 -0.04282 0.36513 -0.117 0.907
fcond1 0.22641 0.29813 0.759 0.451
Residual standard error: 1.155 on 56 degrees of freedom
Multiple R-squared: 0.04019, Adjusted R-squared: -0.01122
F-statistic: 0.7817 on 3 and 56 DF, p-value: 0.5091
Call:
lm(formula = pc[, 5] ~ fbatch + fcond)
Residuals:
Min 1Q Median 3Q Max
-2.6261 -0.7063 0.0244 0.7560 2.1307
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1117 0.2764 -0.404 0.6877
fbatch2 -0.2357 0.3385 -0.696 0.4891
fbatch3 -0.1891 0.3385 -0.559 0.5787
fcond1 0.5066 0.2764 1.833 0.0721 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.071 on 56 degrees of freedom
Multiple R-squared: 0.06516, Adjusted R-squared: 0.01508
F-statistic: 1.301 on 3 and 56 DF, p-value: 0.2831
$call
lm(formula = pc[, 1] ~ fbatch + fcond)
$terms
pc[, 1] ~ fbatch + fcond
attr(,"variables")
list(pc[, 1], fbatch, fcond)
attr(,"factors")
fbatch fcond
pc[, 1] 0 0
fbatch 1 0
fcond 0 1
attr(,"term.labels")
[1] "fbatch" "fcond"
attr(,"order")
[1] 1 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: 0xc9f6db0>
attr(,"predvars")
list(pc[, 1], fbatch, fcond)
attr(,"dataClasses")
pc[, 1] fbatch fcond
"numeric" "factor" "factor"
$residuals
1 2 3 4 5 6
-0.46611041 1.46286517 0.67356663 -0.68252775 0.49949592 0.74902441
7 8 9 10 11 12
-0.11415040 -0.86476060 0.68476961 -1.49574840 0.09938608 -0.53631554
13 14 15 16 17 18
1.07727822 0.74014899 0.40514804 -1.95357677 -0.08305834 -0.26219989
19 20 21 22 23 24
-0.06197237 0.12873740 0.65964268 -1.00522026 0.01055691 0.76287893
25 26 27 28 29 30
-0.14575829 -1.47343195 0.28664538 0.66568565 -0.65497228 0.62023860
31 32 33 34 35 36
-1.62106060 -0.01952931 0.99270340 0.96844451 0.54498337 0.50736683
37 38 39 40 41 42
0.80330660 -0.88376258 -0.73049157 -0.28822603 -0.08420487 0.59661773
43 44 45 46 47 48
-1.33830464 -0.23245537 1.57877806 -0.35295223 0.18691956 0.18093849
49 50 51 52 53 54
-1.24190125 0.53387496 -0.13204140 -0.44899714 0.08377980 0.12073816
55 56 57 58 59 60
0.22584524 0.11480677 1.15658040 -0.78632546 -0.14081949 -0.02087732
$coefficients
Estimate Std. Error t value Pr(>|t|)
(Intercept) -7.425752 0.2051310 -36.20004 1.539484e-40
fbatch2 5.912143 0.2512332 23.53250 1.024518e-30
fbatch3 12.523882 0.2512332 49.84964 4.362911e-48
fcond1 2.560820 0.2051310 12.48382 8.139951e-18
$aliased
(Intercept) fbatch2 fbatch3 fcond1
FALSE FALSE FALSE FALSE
$sigma
[1] 0.794469
$df
[1] 4 56 4
$r.squared
[1] 0.9792548
$adj.r.squared
[1] 0.9781434
$fstatistic
value numdf dendf
881.1391 3.0000 56.0000
$cov.unscaled
(Intercept) fbatch2 fbatch3 fcond1
(Intercept) 0.06666667 -5.000000e-02 -5.000000e-02 -3.333333e-02
fbatch2 -0.05000000 1.000000e-01 5.000000e-02 -1.839961e-17
fbatch3 -0.05000000 5.000000e-02 1.000000e-01 -2.340556e-18
fcond1 -0.03333333 -1.839961e-17 -2.340556e-18 6.666667e-02
$call
lm(formula = pc[, 2] ~ fbatch + fcond)
$terms
pc[, 2] ~ fbatch + fcond
attr(,"variables")
list(pc[, 2], fbatch, fcond)
attr(,"factors")
fbatch fcond
pc[, 2] 0 0
fbatch 1 0
fcond 0 1
attr(,"term.labels")
[1] "fbatch" "fcond"
attr(,"order")
[1] 1 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: 0xc9f6db0>
attr(,"predvars")
list(pc[, 2], fbatch, fcond)
attr(,"dataClasses")
pc[, 2] fbatch fcond
"numeric" "factor" "factor"
$residuals
1 2 3 4 5 6
0.25600500 -0.03149638 0.16359255 0.31912197 0.55984699 -0.18818923
7 8 9 10 11 12
-0.66429953 0.11333571 -0.37880905 -0.42137161 -0.50986627 0.14578110
13 14 15 16 17 18
0.60536084 0.44250432 -0.48242725 0.75210718 -0.27693196 -1.61027691
19 20 21 22 23 24
0.37875385 0.82725867 -1.51001513 -0.69489384 0.70340786 -0.12810957
25 26 27 28 29 30
1.49674025 -1.18130200 0.71864130 0.94102885 0.70208638 1.38197236
31 32 33 34 35 36
0.01953037 0.57337199 1.20934423 -0.28704994 -0.21400315 -1.70144047
37 38 39 40 41 42
1.08290858 -0.83347830 -2.04221325 -0.23652654 2.89179506 0.16237839
43 44 45 46 47 48
1.09916500 -3.07558237 0.99330608 0.99194686 -0.64813251 -1.99219213
49 50 51 52 53 54
-1.03513496 -1.54484232 1.08135056 1.14286460 -3.79746153 0.63468113
55 56 57 58 59 60
1.47413782 -0.70030060 -0.56106648 2.87317569 1.22777780 -1.21786609
$coefficients
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.09593908 0.3245487 0.2956076 0.7686231
fbatch2 -0.43845211 0.3974894 -1.1030536 0.2747216
fbatch3 -0.07704423 0.3974894 -0.1938271 0.8470126
fcond1 0.15178606 0.3245487 0.4676834 0.6418260
$aliased
(Intercept) fbatch2 fbatch3 fcond1
FALSE FALSE FALSE FALSE
$sigma
[1] 1.256972
$df
[1] 4 56 4
$r.squared
[1] 0.02787995
$adj.r.squared
[1] -0.02419791
$fstatistic
value numdf dendf
0.5353513 3.0000000 56.0000000
$cov.unscaled
(Intercept) fbatch2 fbatch3 fcond1
(Intercept) 0.06666667 -5.000000e-02 -5.000000e-02 -3.333333e-02
fbatch2 -0.05000000 1.000000e-01 5.000000e-02 -1.839961e-17
fbatch3 -0.05000000 5.000000e-02 1.000000e-01 -2.340556e-18
fcond1 -0.03333333 -1.839961e-17 -2.340556e-18 6.666667e-02
$call
lm(formula = pc[, 3] ~ fbatch + fcond)
$terms
pc[, 3] ~ fbatch + fcond
attr(,"variables")
list(pc[, 3], fbatch, fcond)
attr(,"factors")
fbatch fcond
pc[, 3] 0 0
fbatch 1 0
fcond 0 1
attr(,"term.labels")
[1] "fbatch" "fcond"
attr(,"order")
[1] 1 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: 0xc9f6db0>
attr(,"predvars")
list(pc[, 3], fbatch, fcond)
attr(,"dataClasses")
pc[, 3] fbatch fcond
"numeric" "factor" "factor"
$residuals
1 2 3 4 5 6
-0.44357285 0.88992339 -0.57990996 -0.04843986 0.71755940 0.33817658
7 8 9 10 11 12
-0.38106237 -0.04340122 0.51568401 -0.99389985 -1.46927952 1.43498822
13 14 15 16 17 18
-1.13285232 0.63746842 0.69661303 0.57321329 -0.16715480 -1.62610896
19 20 21 22 23 24
0.36297915 0.71907622 0.60290407 0.68475597 -0.62732925 0.53964994
25 26 27 28 29 30
-0.86408918 -1.59458001 -1.32694101 0.54812598 0.14990826 -0.73846372
31 32 33 34 35 36
1.15995818 0.67636665 -0.64495913 0.25707765 1.10756558 1.22211427
37 38 39 40 41 42
1.52007633 -0.82870883 -0.55468788 -1.28874388 0.45453102 0.32447239
43 44 45 46 47 48
0.45209051 -0.78499175 -0.31170871 1.54319504 -1.04846568 1.26978399
49 50 51 52 53 54
0.05706515 0.69902972 -1.96836404 2.60765918 -0.45791154 -4.62005933
55 56 57 58 59 60
0.13981892 -0.22262021 2.11774453 -1.04916069 0.47004936 0.32784214
$coefficients
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.339994025 0.3004628 1.131567626 0.262638759
fbatch2 -0.001187559 0.3679903 -0.003227148 0.997436582
fbatch3 0.195880602 0.3679903 0.532298240 0.596625204
fcond1 -0.809783411 0.3004628 -2.695119990 0.009272101
$aliased
(Intercept) fbatch2 fbatch3 fcond1
FALSE FALSE FALSE FALSE
$sigma
[1] 1.163688
$df
[1] 4 56 4
$r.squared
[1] 0.1201023
$adj.r.squared
[1] 0.07296496
$fstatistic
value numdf dendf
2.547922 3.000000 56.000000
$cov.unscaled
(Intercept) fbatch2 fbatch3 fcond1
(Intercept) 0.06666667 -5.000000e-02 -5.000000e-02 -3.333333e-02
fbatch2 -0.05000000 1.000000e-01 5.000000e-02 -1.839961e-17
fbatch3 -0.05000000 5.000000e-02 1.000000e-01 -2.340556e-18
fcond1 -0.03333333 -1.839961e-17 -2.340556e-18 6.666667e-02
$call
lm(formula = pc[, 4] ~ fbatch + fcond)
$terms
pc[, 4] ~ fbatch + fcond
attr(,"variables")
list(pc[, 4], fbatch, fcond)
attr(,"factors")
fbatch fcond
pc[, 4] 0 0
fbatch 1 0
fcond 0 1
attr(,"term.labels")
[1] "fbatch" "fcond"
attr(,"order")
[1] 1 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: 0xc9f6db0>
attr(,"predvars")
list(pc[, 4], fbatch, fcond)
attr(,"dataClasses")
pc[, 4] fbatch fcond
"numeric" "factor" "factor"
$residuals
1 2 3 4 5 6
0.676033505 -0.658514298 1.179868113 -1.348393011 1.084563521 0.300738531
7 8 9 10 11 12
0.668547557 0.216140642 0.393492853 -0.356310152 -0.890955549 0.326366538
13 14 15 16 17 18
-0.290742637 -0.461343788 -0.006339403 0.283584088 -0.074497013 -0.438834197
19 20 21 22 23 24
0.599458914 -1.202864213 -0.886205122 0.295894184 1.169700492 -0.738251555
25 26 27 28 29 30
-1.377811845 -0.366983495 -1.283439404 -1.675269985 2.420075700 0.628267220
31 32 33 34 35 36
1.891149748 -0.475023583 0.369056676 -0.247296906 1.210210293 -1.406922987
37 38 39 40 41 42
-0.065842208 -1.123081231 2.060155170 -0.398381163 2.242488550 -0.758852498
43 44 45 46 47 48
-2.196476291 0.582209698 -0.753442289 0.756160747 0.493200050 -0.051397329
49 50 51 52 53 54
-0.559375155 -0.096658933 0.633778589 -3.347550286 -0.255192299 -0.700765984
55 56 57 58 59 60
1.821463075 -1.513095237 1.783774212 -0.491581306 1.305559403 1.105753283
$coefficients
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.23141955 0.2981283 -0.7762415 0.4408727
fbatch2 0.39745613 0.3651311 1.0885300 0.2810238
fbatch3 -0.04281864 0.3651311 -0.1172692 0.9070663
fcond1 0.22641411 0.2981283 0.7594520 0.4507674
$aliased
(Intercept) fbatch2 fbatch3 fcond1
FALSE FALSE FALSE FALSE
$sigma
[1] 1.154646
$df
[1] 4 56 4
$r.squared
[1] 0.04019473
$adj.r.squared
[1] -0.01122341
$fstatistic
value numdf dendf
0.7817227 3.0000000 56.0000000
$cov.unscaled
(Intercept) fbatch2 fbatch3 fcond1
(Intercept) 0.06666667 -5.000000e-02 -5.000000e-02 -3.333333e-02
fbatch2 -0.05000000 1.000000e-01 5.000000e-02 -1.839961e-17
fbatch3 -0.05000000 5.000000e-02 1.000000e-01 -2.340556e-18
fcond1 -0.03333333 -1.839961e-17 -2.340556e-18 6.666667e-02
$call
lm(formula = pc[, 5] ~ fbatch + fcond)
$terms
pc[, 5] ~ fbatch + fcond
attr(,"variables")
list(pc[, 5], fbatch, fcond)
attr(,"factors")
fbatch fcond
pc[, 5] 0 0
fbatch 1 0
fcond 0 1
attr(,"term.labels")
[1] "fbatch" "fcond"
attr(,"order")
[1] 1 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: 0xc9f6db0>
attr(,"predvars")
list(pc[, 5], fbatch, fcond)
attr(,"dataClasses")
pc[, 5] fbatch fcond
"numeric" "factor" "factor"
$residuals
1 2 3 4 5 6
0.014654976 0.401223602 -0.404768253 1.091163931 0.215576187 1.069462223
7 8 9 10 11 12
-0.524442392 -0.457715317 0.316172519 0.028050858 -0.131363704 0.729068532
13 14 15 16 17 18
0.876444362 -0.773886975 -0.141427915 -1.611025195 -0.494940481 -0.006850571
19 20 21 22 23 24
0.020746241 -0.216142628 0.139564997 0.481066220 -0.903036108 1.743453156
25 26 27 28 29 30
-1.770321060 0.574808747 -0.320004549 0.836753682 0.052290436 -1.241243657
31 32 33 34 35 36
0.938143151 1.201496731 -0.412531447 -1.129584621 1.016750635 -1.367896424
37 38 39 40 41 42
0.109952917 1.422038943 -0.467118016 -0.904583734 -0.683746034 -1.687276819
43 44 45 46 47 48
1.032950098 -0.217697901 2.087959173 0.531984465 0.566096582 0.662533269
49 50 51 52 53 54
-1.324637126 -2.310875905 -2.626112274 -0.866543417 1.569150540 0.141658302
55 56 57 58 59 60
2.130727900 0.495851644 0.997323696 1.350007810 -1.051296342 -0.798057659
$coefficients
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1116920 0.2764076 -0.4040842 0.68768991
fbatch2 -0.2357319 0.3385288 -0.6963422 0.48909486
fbatch3 -0.1890961 0.3385288 -0.5585818 0.57867393
fcond1 0.5066025 0.2764076 1.8328095 0.07214897
$aliased
(Intercept) fbatch2 fbatch3 fcond1
FALSE FALSE FALSE FALSE
$sigma
[1] 1.070522
$df
[1] 4 56 4
$r.squared
[1] 0.0651571
$adj.r.squared
[1] 0.01507623
$fstatistic
value numdf dendf
1.301038 3.000000 56.000000
$cov.unscaled
(Intercept) fbatch2 fbatch3 fcond1
(Intercept) 0.06666667 -5.000000e-02 -5.000000e-02 -3.333333e-02
fbatch2 -0.05000000 1.000000e-01 5.000000e-02 -1.839961e-17
fbatch3 -0.05000000 5.000000e-02 1.000000e-01 -2.340556e-18
fcond1 -0.03333333 -1.839961e-17 -2.340556e-18 6.666667e-02
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.