# big_cor: Correlation In bigstatsr: Statistical Tools for Filebacked Big Matrices

## Description

Compute the (Pearson) correlation matrix of a Filebacked Big Matrix.

## Usage

 ```1 2 3 4 5 6``` ```big_cor( X, ind.row = rows_along(X), ind.col = cols_along(X), block.size = block_size(nrow(X)) ) ```

## Arguments

 `X` An object of class FBM. `ind.row` An optional vector of the row indices that are used. If not specified, all rows are used. Don't use negative indices. `ind.col` An optional vector of the column indices that are used. If not specified, all columns are used. Don't use negative indices. `block.size` Maximum number of columns read at once. Default uses block_size.

## Value

A temporary FBM, with the following two attributes:

• a numeric vector `center` of column scaling,

• a numeric vector `scale` of column scaling.

## Matrix parallelization

Large matrix computations are made block-wise and won't be parallelized in order to not have to reduce the size of these blocks. Instead, you may use Microsoft R Open or OpenBLAS in order to accelerate these block matrix computations. You can also control the number of cores used with `bigparallelr::set_blas_ncores()`.

cor big_crossprodSelf

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```X <- FBM(13, 17, init = rnorm(221)) # Comparing with cor K <- big_cor(X) class(K) dim(K) K\$backingfile true <- cor(X[]) all.equal(K[], true) # Using only half of the data n <- nrow(X) ind <- sort(sample(n, n/2)) K2 <- big_cor(X, ind.row = ind) true2 <- cor(X[ind, ]) all.equal(K2[], true2) ```

### Example output

```sh: 1: wc: Permission denied
sh: 1: cannot create /dev/null: Permission denied
[1] "FBM"
attr(,"package")
[1] "bigstatsr"
[1] 17 17
[1] "/work/tmp/tmp/Rtmpx3KVHX/file10e32b481838.bk"
[1] TRUE
[1] TRUE
```

bigstatsr documentation built on April 5, 2021, 5:08 p.m.