Fit a low-rank LMM on raw genotypes (no explicit scaling).

biglmmg(
  y,
  X,
  G,
  cols = seq(ncol(G)),
  M = length(cols),
  K = NULL,
  REML = TRUE,
  compute_mult = TRUE,
  verbose = 0
)

Arguments

y

A vector of trait values (quantitative trait).

X

A matrix of covariates. The default value is matrix of ones for the intercept (one column).

G

A FBM matrix of genotypes. Missing values are not handled.

cols

A vector of columns of G to be used in the model. By default, all columns of G are used.

M

A scalar for normalization of the genetic relationship matrix: GRM = Z'Z / M, where Z is a matrix of standardized genotypes. By default, M = length(cols).

K

A matrix with the pre-computed cross-product Z'Z / M. By default, K = NULL, that means K is pre-computed inside the function.

REML

A boolean specifying the likelihood function, REML or ML.

compute_mult

A boolean enabling the computation of the effective sample size, when only model fitting is needed. The default value is TRUE.

verbose

The verbose level. The default value is 0 (verbose).

Details

The linear mixed model (LMM) is: y_i = X_i b + u_i + e_i, where

u ~ N(0, s2*h2*G) and e ~ N(0, s2 I)

var(y) = V = s2 * (h2*G + I)

Examples

G <- attach_example200() # load simulated genotypes G
#> A Filebacked Big Matrix of type 'code 256' with 1500 rows and 200 columns.
G[1:5, 1:10]
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 2 1 0 2 1 1 1 1 2 1 #> [2,] 1 2 1 1 2 1 1 2 1 1 #> [3,] 2 2 1 1 1 1 1 0 2 0 #> [4,] 0 2 0 2 1 0 0 1 0 2 #> [5,] 1 2 0 2 2 1 0 0 1 0
y <- rnorm(nrow(G)) # generate a random phenotype head(y)
#> [1] 0.51242695 -1.86301149 -0.52201251 -0.05260191 0.54299634 -0.91407483
mod <- biglmmg(y, G = G) mod$gamma # estimated h2
#> [1] 6.610696e-05