Re: Strange behaviour of <=?
- From: "us " <us@xxxxxxxxxxxxxxx>
- Date: Thu, 28 May 2009 09:45:03 +0000 (UTC)
"Mattias " <mattias_winterdahl@xxxxxxxxxxxx> wrote in message <gvllkl$mic$1@xxxxxxxxxxxxxxxxxx>...
"us " <us@xxxxxxxxxxxxxxx> wrote in message <gvlk22$6q8$1@xxxxxxxxxxxxxxxxxx>...
"Mattias " <mattias_winterdahl@xxxxxxxxxxxx> wrote in message <gvljmq$a4s$1@xxxxxxxxxxxxxxxxxx>...
Hi everyone! I have a problem I hope someone could help me with.
I have a vector from which I want to store the values below some percentile. So I tried both quantile() and prctile() like this:
quant_q = quantile(Q, quantile_lim);
while i <= length(Q)
if Q(i) <= quant_q
base_q(j) = Q(i);
...
The strange thing is that I only get values like 0.7000, 0.8000, 0.3000 though I know I have values that are below my quantile limit with another "decimal form", e.g. 0.7422. Why do I only get decimal values that end in zeros? Does anyone know why I get this strange behaviour? I would very much appreciate any help on this!
/MW
can you produce a copy/paste-able example of typical SMALL data set and a complete loop...
us
Data set:
Q = [0.9111 0.9778 0.7222 0.7000 0.8000 0.7833 1.003 1.022 0.9556 0.9333 0.9000];
i = 1;
j = 1;
quantile_lim = 0.25;
quant_q = quantile(Q, quantile_lim);
while i <= length(Q)
if Q(i) <= quant_q
base_q(j) = Q(i);
j = j + 1;
end
i = i + 1;
end
I tried this myself, but then it works. Is it my original Q-vector that could be the source of this error? And in that case how? The data has passed quite some steps up till here. I imported it from an excel-file, checked for any NaNs, removed those etc.
a slighly different approach could look like this
d=[
0.9111 0.9778 0.7222 0.7000 0.8000,...
0.7833 1.003 1.022 0.9556 0.9333 0.9000
];
qlim=.25;
lim=quantile(d, qlim);
[ix,ix]=histc(d,[0,lim,1]);
r=d(find(ix==1))
% r = 0.7222 0.7 0.7833
us
.
- References:
- Strange behaviour of <=?
- From: Mattias
- Re: Strange behaviour of <=?
- From: us
- Re: Strange behaviour of <=?
- From: Mattias
- Strange behaviour of <=?
- Prev by Date: Re: help needed in selecting ROI
- Next by Date: Re: Strange behaviour of <=?
- Previous by thread: Re: Strange behaviour of <=?
- Next by thread: Re: Strange behaviour of <=?
- Index(es):
Relevant Pages
|