Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Getting Values for shortest half range

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Nov 22, 2016 12:08 PM
(5248 views)

Is there a way to get the actual values from the shortest half vis in the outlier box plot?

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Tonya's solution is clever and right to the point. The rest of the script is actually not that bad. The variable jrn contains a string representation of the Distriution platform (not just the Outlier Box Plot). So let's use string functions to suss out the desired ends of the red bracket. We find argument with Contains() and we extract the bits with a succession of calls to Word():

```
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = dt << Distribution( Y( :weight ) );
rpt = dist << Report;
jrn = rpt[FrameBox(2)] << Get Journal;
pos = Contains( Upper Case( jrn ), "ADJACENTS" );
adj = Word( 2, Sub Str( jrn, pos ), "()" );
lo = Num( Word( 3, adj, "," ) );
hi = Num( Word( 4, adj, "," ) );
```

Learn it once, use it forever!

8 REPLIES 8

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Getting Values for shortest half range

I don't see anyway to retrieve such information. I tried a real simpleton method of looking at the ranges of 50% of the data from lowest to highest, to see if that would match up, but it failed. It would be a nice enhancement, to be able to "<< get shorterhalf values".

I would pass it on to support@jmp.com

I would pass it on to support@jmp.com

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Getting Values for shortest half range

Yes, but it is not particularly easy. These values present themselves as the last two numbers in the adjacents portion of the journal. First you need to get the journal for a box plot.

```
dt=Open("$SAMPLE_DATA/Big Class.jmp");
obj=dt<<Distribution(Y(:height));
rpt=obj<<report;
jrn=rpt[FrameBox(2)]<<get journal;
```

Next, you will have to parse jrn for adjacents. Perhaps someone with more JSL experience can help you with that if you do not already know how to do that. I'm not familiar with the ins and outs of parsing.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Tonya's solution is clever and right to the point. The rest of the script is actually not that bad. The variable jrn contains a string representation of the Distriution platform (not just the Outlier Box Plot). So let's use string functions to suss out the desired ends of the red bracket. We find argument with Contains() and we extract the bits with a succession of calls to Word():

```
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = dt << Distribution( Y( :weight ) );
rpt = dist << Report;
jrn = rpt[FrameBox(2)] << Get Journal;
pos = Contains( Upper Case( jrn ), "ADJACENTS" );
adj = Word( 2, Sub Str( jrn, pos ), "()" );
lo = Num( Word( 3, adj, "," ) );
hi = Num( Word( 4, adj, "," ) );
```

Learn it once, use it forever!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Getting Values for shortest half range

Thanks for finishing my script, Mark! I've never been the most efficient with the character functions.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Getting Values for shortest half range

Hi Tonya,

Any reason you could think of that I'd get a value of

adjacents(0,0,0,0)

?

It's definitely not 0-0 as the shortest range. Sorry but I can't post the actual data. I'll see if I'm allowed to anonymize it.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Getting Values for shortest half range

Hi Tonya,

Any reason you could think of that I'd get a value of

adjacents(0,0,0,0)

?

It's definitely not 0-0 as the shortest range. Sorry but I can't post the actual data. I'll see if I'm allowed to anonymize it.

*Edit* Nevermind. For some reason my adjacents went to Framebox(1) and all the framebox(2) were 0s.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Getting Values for shortest half range

This isn't really an answer, but maybe useful in some cases. If you just wanted to see the shortest half values, you could save as Interactive HTML and hover over the red bracket.

When viewing in a mobile browser, just tap the red bracket.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Getting Values for shortest half range

Thanks for sharing the *<<Get Journal* idea. Really clever and new to me.

Here's an attempt to get the limits by raw calculation. In my limited testing it compares well with the Journal numbers. It seems to handle missing values and ties as expected (but I may have missed something).

```
// Function for calculating the lower and upper limits of
// Shortest Half Range of a numeric column.
shorth = Function({col}, {M, n, d, i = 0},
M = col << get values;
M = Sort Ascending(M[Loc Nonmissing(M)]);
n = N Row(M) / 2 + Mod(N Row(M), 2);
d = Loc Min(J(1, n, M[(i++) + n] - M[i]));
lo = M[d];
hi = M[d + n - 1];
);
// Test
dt = Open("$SAMPLE_DATA/Big Class.jmp");
shorth(Column(dt, "weight"));
Show(lo, hi);
```