redmm: Reduced Model Matrix

redmmR Documentation

Reduced Model Matrix

Description

'redmm' uses a feature matrix M from a random variable x and performs a singular value decomposition or Cholesky on M and creates a model matrix for x.

Usage

  redmm(x, M = NULL, Lam=NULL, nPC=50, cholD=FALSE, returnLam=FALSE)

Arguments

x

as vector with values to form a model matrix or the matrix itself for an effect of interest.

M

a matrix of features explaining the levels of x.

Lam

a matrix of loadings in case is already available to avoid recomputing it.

nPC

number of principal components to keep from the matrix of loadings to form the model matrix.

cholD

should a Cholesky or a Singular value decomposition should be used. The default is the SVD.

returnLam

should the function return the loading matrix in addition to the incidence matrix. Default is FALSE.

Value

$S3

A list with 3 elements:

1) The model matrix to be used in the mixed modeling.

2) The reduced matrix of loadings (nPC columns).

3) The full matrix of loadings.

Author(s)

Giovanny Covarrubias-Pazaran

References

Covarrubias-Pazaran G (2016) Genome assisted prediction of quantitative traits using the R package sommer. PLoS ONE 11(6): doi:10.1371/journal.pone.0156744

See Also

The core functions of the package mmec

Examples

  
####=========================================####
#### For CRAN time limitations most lines in the 
#### examples are silenced with one '#' mark, 
#### remove them and run the examples
####=========================================####

data(DT_technow)
DT <- DT_technow
Md <- Md_technow

M <- tcrossprod(Md)
xx = with(DT, redmm(x=dent, M=M, nPC=10))

# ans <- mmec(GY~1,
#             # new model matrix instead of dent
#             random=~vsc(isc(xx$Z)),
#             rcov=~units,
#             data=DT)
# summary(ans)$varcomp
# u = xx$Lam * ans$uList[[1]] # change * for matrix product


sommer documentation built on Nov. 13, 2023, 9:05 a.m.