[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: var(x) and std(x)
From: |
John W. Eaton |
Subject: |
Re: var(x) and std(x) |
Date: |
Tue, 12 Nov 2002 13:03:13 -0600 |
On 12-Nov-2002, Paul Kienzle <address@hidden> wrote:
| Index: var.m
| ===================================================================
| RCS file: /cvs/octave/scripts/statistics/base/var.m,v
| retrieving revision 1.6
| diff -c -r1.6 var.m
| *** var.m 2002/09/26 22:48:24 1.6
| --- var.m 2002/11/12 18:30:44
| ***************
| *** 40,48 ****
| y = 0;
| elseif ((nr == 1) || (nc == 1))
| n = length (x);
| ! y = (sumsq (x) - abs(sum(x))^2 / n) / (n - 1);
| else
| ! y = (sumsq (x) - abs(sum(x)).^2 / nr) / (nr - 1);
| endif
|
| endfunction
| --- 40,48 ----
| y = 0;
| elseif ((nr == 1) || (nc == 1))
| n = length (x);
| ! y = sumsq (x - sum (x) / n) / (n - 1);
| else
| ! y = sumsq (x - ones (nr, 1) * (sum (x) / nr) ) / (nr - 1);
| endif
|
| endfunction
I applied this patch.
Thanks,
jwe
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------