permuteExplVar {MatrixQCvis} | R Documentation |
The function 'permuteExplVar' determines the explained variance of the permuted expression matrix ('x'). It is used to determine the optimal number of PCs for tSNE.
permuteExplVar(x, n = 10, center = TRUE, scale = TRUE)
x |
'matrix' or 'data.frame', samples in columns and features in rows |
n |
'numeric', number of permutation rounds |
center |
'logical', passed to the function 'explVar' |
scale |
'logical', passed to the function 'explVar' |
For the input of tSNE, typically, we want to reduce the initial number of dimensions linearly with PCA (used as the 'initial_dims' arguments in the 'Rtsne' funtion). The reduced data set is used for feeding into tSNE. By plotting the percentage of variance explained by the Princical Components (PCs) we can estimate how many PCs we keep as input into tSNE. However, if we select too many PCs, noise will be included as input to tSNE; if we select too few PCs we might loose the important data structures. To get a better understanding how many PCs to include, randomization will be employed and the observed variance will be compared to the permuted variance.
matrix with explained variance
Thomas Naake
x <- matrix(1:100, nrow = 10, ncol = 10, dimnames = list(1:10, paste("sample", 1:10))) permuteExplVar(x = x, n = 10, center = TRUE, scale = TRUE)