Compute the effective sample size for a LMM.

ess(G, cols = seq(ncol(G)), M = length(cols), h2, s2 = 1)

Arguments

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).

h2

The estimated heritability in the LMM.

s2

The estimated scaling constant for the variance components in the LMM.

Value

A data.frame of results.

Examples

#> 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
ess(G, h2 = 0.5)
#> N M h2 s2 mult ESS #> 1 1500 200 0.5 1 1.768339 2652.508
ess(G, h2 = 0.8)
#> N M h2 s2 mult ESS #> 1 1500 200 0.8 1 4.357941 6536.911