pspp-dev
[Top][All Lists]

Re: reg_sweep

 From: John Darrington Subject: Re: reg_sweep Date: Thu, 26 Aug 2010 12:57:28 +0000 User-agent: Mutt/1.5.18 (2008-05-17)

```On Wed, Aug 25, 2010 at 05:37:49PM -0400, Jason Stover wrote:
On Wed, Aug 25, 2010 at 02:43:07PM +0000, John Darrington wrote:

> 1. The comment says:
>   /*
>    LAST_COL is considered to be the final column in the augmented matrix,
>    that is, the column to the right of the '=' sign of the system.
>    */
>
>   If I understand the theory correct, this should read "to the LEFT of
the = sign" ??

I was thinking of it this way:

Suppose A is an n by n matrix, x an n by 1 vector, and y an n by 1
vector. The values of A and y are known. reg_sweep solves the system

A x = y

for x. This is done by forming an augmented matrix

a_{11} a_{12} ... a_{1n} | y_1
a_{21} a_{22} ... a_{2n} | y_2
........................ | ..
a_{n1} a_{n2} ... a_{nn} | y_n

and using Gaussian elimination. I thought I had coded reg_sweep to
assume LAST_COL was the column corresponding to the vector y above,
which is on the right-hand side of Ax = y.

Right.  My confusion arose because earlier in the comment, the
equation is formulated with Y on the left: "Y = Xb + Z".

> 2. Results from my initial experiments suggest that:
>
>    a) In order to  do a factorial anova, we would need to run reg_sweep
N times where
>       N is this number of factor variables.

No, it should only require one call of reg_sweep on the covariance matrix.
Unless there is more than one dependent variable, one call to reg_sweep
should suffice.

>    b) We need to add another variable to reg_sweep to tell it which
variable we're currentl
>       interested in.

I don't understand what you mean by "which variable we're currently
interested in." Do you mean the dependent variable? Anyway, reg_sweep
is meant to be dumb: It just runs Gaussian elimination.

It sounds like you are using it wrong, though there is a chance it
needs updating. I can help if you send some sample code.

I'm starting with a simple univariate anova, using my rapidly hacked up version
of
GLM:

glm Y by X1 X2.

In my glm implementation I have the following code:
{
gsl_matrix *cm = covariance_calculate_unnormalized (cov);

dump_matrix (cm);

reg_sweep (cm, 0);

dump_matrix (cm);
}

I can see that before the sweep operatotr, the Corrected Total is in CM(0,0)
I can also see that after the sweep operator, CM(0,0) contains
(CorrectedTotal - SumOfSquaresForX1).  How do I get the sum of squares for X2?
The only way I can see it is to re-arrange the rows/columns of CM such that X2
is
the first factor and re-run reg_sweep.

J'

--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.

```

signature.asc
Description: Digital signature