Skip to content
Back to formatted view

Raw Message

Message-ID: <498C4928.2040409@biostat.ku.dk>
Date: 2009-02-06T14:28:56Z
From: Peter Dalgaard
Subject: Finding a basis in a set of vectors
In-Reply-To: <b19557450902060610j58c06e06yf87cc71b8ce08f0d@mail.gmail.com>

Zhou Fang wrote:
> Hi,
> 
> Okay, I have a n x p matrix X, which I know is not full rank. In
> particular, there may be linear dependencies amongst the columns (but
> not that many). What is a fast way of finding a linearly independent
> subset of the columns of X that will span the column space of X, in R?
> If it helps, I have the QR decomposition of the original X 'for free'.
> 
> I know that it's possible to do this directly by looping over the
> columns and adding them, but at the very least, a solution without
> horrible slow loops would be nice.

Have a look at stats:::Thin.col(), but beware that it isn't terribly robust.

> Any ideas welcome.
> 
> Zhou Fang
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907