bed_randomSVD {bigsnpr} | R Documentation |
Randomized partial SVD
Description
Partial SVD (or PCA) of a genotype matrix stored as a PLINK (.bed) file.#'
Usage
bed_randomSVD(
obj.bed,
fun.scaling = bed_scaleBinom,
ind.row = rows_along(obj.bed),
ind.col = cols_along(obj.bed),
k = 10,
tol = 1e-04,
verbose = FALSE,
ncores = 1
)
Arguments
obj.bed |
Object of type bed, which is the mapping of some bed file.
Use |
fun.scaling |
A function with parameters
Default doesn't use any scaling.
You can also provide your own |
ind.row |
An optional vector of the row indices (individuals) that
are used. If not specified, all rows are used. |
ind.col |
An optional vector of the column indices (SNPs) that are used.
If not specified, all columns are used. |
k |
Number of singular vectors/values to compute. Default is |
tol |
Precision parameter of svds. Default is |
verbose |
Should some progress be printed? Default is |
ncores |
Number of cores used. Default doesn't use parallelism. You may use nb_cores. |
Value
A named list (an S3 class "big_SVD") of
-
d
, the singular values, -
u
, the left singular vectors, -
v
, the right singular vectors, -
niter
, the number of the iteration of the algorithm, -
nops
, number of Matrix-Vector multiplications used, -
center
, the centering vector, -
scale
, the scaling vector.
Note that to obtain the Principal Components, you must use predict on the result. See examples.
Examples
bedfile <- system.file("extdata", "example.bed", package = "bigsnpr")
obj.bed <- bed(bedfile)
str(bed_randomSVD(obj.bed))