Learn R Programming

HDBRR (version 1.1.4)

matop: matop

Description

Compute the SVD or QR decomposition of the matrix X.

Usage

matop(y = NULL, X, method = c("svd", "qr"), bigmat = TRUE)

Value

If the method used is svd then the list containing the following components:

y

The data vector (numeric, n) NAs allowed.

X

Design Matrix of dimension n x p.

D

A vector containing the singular values of X, of lenght min(n,p).

L

A matrix whose columns contain the left singular vectors of X,

R

A matrix whose columns contain the right singular vectors of X.

ev

A vector containing the square of D.

Ly

The cross-product between the matrix L and vector y.

n

Number of rows of X.

p

Number of columns of X.

If the method used is qr then the list containing the following components:

y

The data vector (numeric, n) NAs allowed.

X

Design Matrix of dimension n x p.

R

An upper triangular matrix of dimension n x p.

n

Number of rows of X.

p

Number of columns of X.

Arguments

y

The data vector (numeric, n) NAs allowed. The default value is NULL, It is possible to compute the SVD or QR decomposition without y.

X

Design Matrix of dimension n x p.

method

Options for the posterior computation. Two methods, "qr" and "svd" decomposition. The default value for the method is SVD descomposition.

bigmat

Use of the bigstatsr package. The default value for bigmat is TRUE.

Author

Sergio Perez-Elizalde, Blanca E. Monroy-Castillo, Paulino Perez-Rodriguez.

Details

Use the bigstartsr package when p >> n. Auxiliary in the HDBRR function.

See Also

Examples

Run this code
n <- 30
p <- 100
X <- matrix(rnorm(n*(p-1),1,1/p),nrow = n,ncol = p-1)
Beta <- sample(1:p,p-1,rep = FALSE)
Beta <- c(1,Beta)
y <- cbind(rep(1,n),X) %*% Beta+rnorm(n,0,1)
matop(y, X, bigmat = TRUE)

Run the code above in your browser using DataLab