As Raul says, "possibly this depends on the value of a."
Keith didn't use an edge condition detector in his expository
training script.
You can see the problem even with a simple vector:
(Q1,Q2,Q3) 0 1 2
0 1 2
(Q1,Q2,Q3) 0 0 1
|index error: median
| (Q1,Q2,Q3)0 0 1
The trouble with the second case is that the median (Q2) is 0,
so there are no values below it, so Q1 throws the error.
However,
(Q1,Q2,Q3) 0 1 1
|index error: median
| (Q1,Q2,Q3)0 1 1
because there are no values above the median, ie 1, and Q3 throws
the condition.
These seem to me to be reasonable amendments:
q1=:(Q1 :: <./) NB. default to minimum
q3=:(Q3 :: >./) NB. default to maximum
(q1,Q2,q3) 0 1 1
0 1 1
(q1,Q2,q3) 0 0 1
0 0 1
For an example with 10 "experiments":
(Q1)"1 |:(4 10 $ i.10) NB. fails because each set only has one
repeated value
|index error: median
| (Q1)"1|:(4 10$i.10)
(q1)"1 |:(4 10 $ i.10) NB. but this works...
0 1 2 3 4 5 6 7 8 9
If your data gets really large, you might consider coding the quartiles
directly as special cases of percentiles.
Mike
Raul Miller wrote:
On 6/5/08, Bill Harris <[EMAIL PROTECTED]> wrote:
$ Q1 each <"1 |: a
|index error: median
| $ Q1 each<"1|:a
When I set a=:?.17 100$0 I get
$ Q1 each <"1 |: a
100
But possibly this depends on the value of a.
You should be able to figure out which columns
of a trigger your problem with an expression like:
I.(<0) = Q1 ::0: each <"1|:a
Once you have found an example, you can post those
17 values.
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG.
Version: 8.0.100 / Virus Database: 269.24.6/1480 - Release Date: 03/06/2008 07:00
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm