[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #10103] Add weighted standard deviation fe
From: |
anonymous |
Subject: |
[Octave-patch-tracker] [patch #10103] Add weighted standard deviation feature to 'std' |
Date: |
Thu, 2 Sep 2021 10:00:50 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 |
Follow-up Comment #8, patch #10103 (project octave):
[comment #7 comment #7:]
> what other functions does the weighting apply to?
>
It is used by mean, std, var, maybe others. On top of that it should apply to
'center' too.
However, to say the truth, I think that std in MATLAB is just:
retval = sqrt (var (varargin{:}));
So var.m should be something like:
den = sum (w);
mu = mean (x, dim, w);
retval = sum (w .* ((x .- mu) .^ 2)) / den;
or
den = sum (w);
cx = center (x, dim, w);
retval = sum (w .* (cx .^ 2)) / den;
And std.m should be just its square root, maybe with a bit of input checking
before that.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/patch/?10103>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/