octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #52685] redundant sentence in meansq docstring

 From: Dan Sebald Subject: [Octave-bug-tracker] [bug #52685] redundant sentence in meansq docstring Date: Tue, 19 Dec 2017 18:12:48 -0500 (EST) User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

```Follow-up Comment #15, bug #52685 (project octave):

Regarding OLS, I think there is confusion between s and S where perhaps S =
diag(s.^2), s being the standard deviation and I being the identity matrix.
The kron() could be confusing things.

Let's do a simple test using the variable/case naming convention that we find
in the plaintext ols.m help and make the r.v.s all Gaussian so we know what to
expect by multiplying by s (std dev).  I'm not interested in BETA, so let's
just multiply X by 3, i.e., BETA = 3*eye(t).

octave:55> s = [0.5 1.0 1.5];
octave:56> X = randn(1000,3) * [1 0 0; 0 2 0; 0 0 3];
octave:57> E = randn(size(X)) * diag(s);
octave:58> Y = 3*X + E;
octave:59> [BETA, SIGMA, R] = ols(Y,X);
octave:60> plot(X,Y,'o');
octave:61> BETA
BETA =

3.0137917  -0.0027791  -0.0164175
-0.0021136   2.9927458   0.0019762
-0.0010545  -0.0137569   3.0187553

octave:62> SIGMA
SIGMA =

0.252791   0.026516   0.019116
0.026516   1.015776  -0.029007
0.019116  -0.029007   2.500401

octave:63> sqrt(SIGMA)
ans =

0.50278 + 0.00000i   0.16284 + 0.00000i   0.13826 + 0.00000i
0.16284 + 0.00000i   1.00786 + 0.00000i   0.00000 + 0.17031i
0.13826 + 0.00000i   0.00000 + 0.17031i   1.58127 + 0.00000i

OK, so BETA looks like 3*eye(t), and SIGMA does look like  diag(s.^2), i.e.,
diag([0.5^2 1.0^2 1.5^2]).

I see now why the original programmer chose vec(E) notation--because E is
actually a matrix.  And it is strange in the sense that if we really
considered the correlation of all residual variables, of which there are t
times p, our correlation matrix (if we were to stack the residuals as [e1; e2;
e3; ...] where e1 is column one, etc.) would be a tp-by-tp matrix.  But I
think the example I gave above is more along the lines of what is meant to be
expressed here, i.e., there are p random residuals with t observed outcomes
per variable.  The vec(E) and kron() stuff doesn't seem correct, or at least
not the clearest way of describing things.  I'll make an attempt at correcting
that for ols.m and gls.m.

_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?52685>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```

reply via email to