help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Matrix regression of distnce matrices + non negative least square


From: Corrado
Subject: Re: Matrix regression of distnce matrices + non negative least square
Date: Mon, 7 Sep 2009 16:13:04 +0100
User-agent: KMail/1.11.4 (Linux/2.6.28-13-generic; KDE/4.2.4; x86_64; ; )

Thanks a lot Jaroslav, I am trying to understand how it works .... :) .... it 
is my first program in octave.

On Monday 07 September 2009 16:04:35 Jaroslav Hajek wrote:
> On Mon, Sep 7, 2009 at 4:21 PM, Corrado<address@hidden> wrote:
> > Dear Jaroslav,
> >
> > thanks for your help.
> >
> > I actually do not understand what you are suggesting:
> >
> > 1) The data would be stored in matrices, which I can easily dump into csv
> > files
>
> OK. But mind you, instead of working with a number of equal-sized
> matrices it is often more efficient to work with a 3D array. Usually
> it depends on where you get the matrices from.
>
> > 2) The distance matrices are up to 5000 x 5000 (but they symmetric, so
> > only n(n-1)/2 are important), but the ones I am using now are just 1500 x
> > 1500.
>
> In that case, it probably doesn't matter much which representation you
> choose.
>
> > 3) I thought lsqnonneg only worked on linear system in the form y=ax
>
> Yes. That's why you need to bring the system into this form.
>
> > 4) The terms are matrices, how do you write a canonical form???? the x1
> > .... xn are matrices (e.g. 1500 x 1500) .... the ci are coefficients in R
> > ....
>
> A matrix equation constitutes a system of equations; one for each
> element. If x1...xN are MxM, you get a
> system of M*(M+1)/2 equations in N variables.
>
> Suppose you have the matrices X in a cell array, so that X{1} is the
> first matrix etc., and the RHS matrix is Y.
> Then you want to do something like
> A = [cellfun (@vech, X, "UniformOutput", false){:}];
> b = vech (Y);
> c = lsqnonneg (A, b);
> To get the coefficients in "c". Note that lsqnonneg is part of Octave
> 3.2.0+. There is a small problem with the above simplistic code: it does
> not discard the diagonal equations, because vech includes the diagonal. You
> can modify vech in order to discard even the diagonal equations.
>
> hth



-- 
Corrado Topi

Global Climate Change & Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]