# colSubset: Full-rank Column Subset In enricoschumann/NMOF: Numerical Methods and Optimization in Finance

## Description

Select a full-rank subset of columns of a matrix.

## Usage

 `1` ```colSubset(x) ```

## Arguments

 `x` a numeric matrix

## Details

Uses `qr`.

## Value

A list:

 `columns` indices of columns `multiplier` a matrix

Enrico Schumann

## References

Gilli, M., Maringer, D. and Schumann, E. (2011) Numerical Methods and Optimization in Finance. Elsevier. http://www.elsevierdirect.com/product.jsp?isbn=9780123756626

Schumann, E. (2016) Financial Optimisation with R (NMOF Manual). http://enricoschumann.net/NMOF.htm#NMOFmanual

`repairMatrix`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20``` ```nc <- 3 ## columns nr <- 10 ## rows M <- array(rnorm(nr * nc), dim = c(nr, nc)) C <- array(0.5, dim = c(nc, nc)) diag(C) <- 1 M <- M %*% chol(C) M <- M[ ,c(1,1,1,2,3)] M (tmp <- colSubset(M)) C <- cor(M[ ,tmp\$columns]) nc <- ncol(C) nr <- 100 X <- array(rnorm(nr*nc), dim = c(nr, nc)) X <- X %*% chol(C) X <- X %*% tmp\$multiplier head(X) cor(X) ```