batchqc_pc_explained_variation {BatchQC} | R Documentation

## Returns explained variation for each principal components

### Description

Returns explained variation for each principal components

### Usage

    batchqc_pc_explained_variation(pcs, vars, condition, batch)

### Arguments

`pcs` | Principal components in the given data
`vars` | Variance of the Principal components in the given data
`condition` | Condition covariate of interest
`batch` | Batch covariate

### Value

Explained variation table for each principal components

### Examples

    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)
    pcs <- t(data.frame(pca$x))
    batchqc_pc_explained_variation(pcs, pca$sdev^2, condition, batch)

[Package BatchQC version 1.10.1 Index]