The function creates a scaling function to be used for linear algebra operations on FBMs through the fun.scaling argument in downstream functions from bigstatsr.

big_scale_grm(center = TRUE, scale = TRUE, M)

Arguments

center

Center?

scale

Scale?

M

A normalization value. It is typically equal to the number of columns in a matrix (for which the scaling function is created).

Value

A function that returns a data.frame with two columns "center" and "scale".

Details

The scaling function works such that the input matrix of raw genotypes is represented as a matrix Z, which cross product is the genetic relationship matrix (GRM), defined as scale(G) scale(G)' / M. In other words, GRM = ZZ'.

Examples

#> [1] 1500 200
M <- dim(G)[2] # number of columns fun_sc <- big_scale_grm(M = M) stats <- do.call(fun_sc, list(G)) str(stats)
#> 'data.frame': 200 obs. of 2 variables: #> $ center: num 0.966 1.002 1.005 0.997 0.997 ... #> $ scale : num 9.85 10.02 9.84 10 9.92 ...
# compare to the standard scaling function from bigstatsr fun_sc0 <- big_scale() stats0 <- do.call(fun_sc0, list(G)) str(stats0)
#> 'data.frame': 200 obs. of 2 variables: #> $ center: num 0.966 1.002 1.005 0.997 0.997 ... #> $ scale : num 0.697 0.709 0.696 0.707 0.701 ...