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
- :
- Bivarite Plot - Obtaining a Combined Data Table

- 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
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Bivarite Plot - Obtaining a Combined Data Table

Sep 21, 2009 9:58 AM
(2400 views)

How do I script the steps to generate a "Combined Data Table" from the Paremeter Estimates in a Bivarite Plot?

Code for my plot...

plot4 = dt00 << Bivariate(

Y(:Median),

X(:Hour),

by (:Temperature,:Cycles,:Distribution),

Group By (:FID_Block),

Fit by(:FID_Block),

Fit special(XTran( Log ),YTran(None)),

SendToReport(Dispatch( {},"1", ScaleBox, {Scale("Log"),

Format "Best", 9), Min(0.9), Max(2000), Inc(1), Minor Ticks(8), Show Major Grid(1), Show Minor Grid(1)}),

Dispatch({}, "2", ScaleBox, {Format("Fixed Dec", 12, 3), Minor Ticks

(1), Show Major Grid(1),

Show Minor Grid(1)}),

Dispatch({},"Bivar Plot",FrameBox, {Frame Size(500, 350), Marker Size(4),

Row Legend(FID_Block,Color(1), Color Theme("JMP Default"), Marker(0), Marker Theme(""),Continuous Scale(0),Reverse Scale(0),

Excluded Rows(0))}))

);

Code for my plot...

plot4 = dt00 << Bivariate(

Y(:Median),

X(:Hour),

by (:Temperature,:Cycles,:Distribution),

Group By (:FID_Block),

Fit by(:FID_Block),

Fit special(XTran( Log ),YTran(None)),

SendToReport(Dispatch( {},"1", ScaleBox, {Scale("Log"),

Format "Best", 9), Min(0.9), Max(2000), Inc(1), Minor Ticks(8), Show Major Grid(1), Show Minor Grid(1)}),

Dispatch({}, "2", ScaleBox, {Format("Fixed Dec", 12, 3), Minor Ticks

(1), Show Major Grid(1),

Show Minor Grid(1)}),

Dispatch({},"Bivar Plot",FrameBox, {Frame Size(500, 350), Marker Size(4),

Row Legend(FID_Block,Color(1), Color Theme("JMP Default"), Marker(0), Marker Theme(""),Continuous Scale(0),Reverse Scale(0),

Excluded Rows(0))}))

);

10 REPLIES 10

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

Re: Bivarite Plot - Obtaining a Combined Data Table

First, your Format is missing a left parenthesis.

Then after your script add:

rplot4 = plot4< rplot4[1]["Parameter Estimates"][Table Box( 1 )] << Make Combined Data Table;

Michael

Then after your script add:

rplot4 = plot4<

Michael

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

Re: Bivarite Plot - Obtaining a Combined Data Table

(mpb) That was exactly what I needed... thanks for the help.

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

Re: Bivarite Plot - Obtaining a Combined Data Table

I have a question related to this:

The script below is trying to create a filter for the data table on the year (Sub_eff_yr) column and also have a bivariate graph for the accumulated data from two of the columns by group one of the columns.

The filter is working, but the graph was not showed up. I'm just wondering why my bivariate graph is not working. Any ideas?

tbl = Current Data Table();

tbl << Color by Column( Sub_eff_yr );

wind = New Window( "Sample",

H List Box(

tbl << Data Filter(

Add Filter(

columns( :Sub_eff_yr),

Display( :Sub_eff_yr, Size( 390, 36 ), Blocks Display ),

),

Mode( Show( 1 ), Include( 1 ))

),

tbl << Bivariate(

Y( Sum(:Success )),

X( Sum(:Submission) ),

Group (:Subagent)

)

)

)

The script below is trying to create a filter for the data table on the year (Sub_eff_yr) column and also have a bivariate graph for the accumulated data from two of the columns by group one of the columns.

The filter is working, but the graph was not showed up. I'm just wondering why my bivariate graph is not working. Any ideas?

tbl = Current Data Table();

tbl << Color by Column( Sub_eff_yr );

wind = New Window( "Sample",

H List Box(

tbl << Data Filter(

Add Filter(

columns( :Sub_eff_yr),

Display( :Sub_eff_yr, Size( 390, 36 ), Blocks Display ),

),

Mode( Show( 1 ), Include( 1 ))

),

tbl << Bivariate(

Y( Sum(:Success )),

X( Sum(:Submission) ),

Group (:Subagent)

)

)

)

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

Re: Bivarite Plot - Obtaining a Combined Data Table

If you just try to run the bivariate by itself:

tbl << Bivariate(

Y( Sum(:Success )),

X( Sum(:Submission) ),

Group (:Subagent)

you will see from the log that you can't use "Sum(:anything)" as an argument to Y or X. You need to make a summary table first and do Bivariate on the summary table. Not clear how your filter will work with the Bivariate plot...depends on the data structure.

tbl << Bivariate(

Y( Sum(:Success )),

X( Sum(:Submission) ),

Group (:Subagent)

you will see from the log that you can't use "Sum(:anything)" as an argument to Y or X. You need to make a summary table first and do Bivariate on the summary table. Not clear how your filter will work with the Bivariate plot...depends on the data structure.

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

Re: Bivarite Plot - Obtaining a Combined Data Table

tbl = Current Data Table();

tbl << Color by Column( Sub_eff_yr );

wind = New Window( "Sample",

H List Box(

tbl << Data Filter(

Add Filter(

columns( :Sub_eff_yr),

Display( :Sub_eff_yr, Size( 390, 36 ), Blocks Display ),

),

Mode( Show( 1 ), Include( 1 ))

),

Outline Box(

"Success vs Submission",

Border Box(

Top(10),

Right(10),

Button Box("Update",Eval(updateGraph))

),

Table Box(

tb1 << Bivariate( Y( :Success ), X( :Submission ) );

)

)

)

);

updateGraph = Expr(

sumTb1 = tbl << Summary(

Group(:Subagent),

Sum(:Submission,:Success,:Failure,:Quoted),

statistics column name format( "column" )

);

sumTb1 << Select Where(:N Rows == 0);

sumTb1 << Delete Rows;

sumTb1 << Minimize Window;

newGraphTbl = Table Box(

sumTb1 << Bivariate( Y( :Success ), X( :Submission ) );

);

wind["Sample"][Table Box(1)] << Delete;

wind["Sample"] << Append(newGraphTbl);

);

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

Re: Bivarite Plot - Obtaining a Combined Data Table

Something like that ought to work. Sorry I don't have the opportunity at the moment to look more closely at your code.

I would recommend testing out each piece of your code separately to see if it does what you want. Then worry about how to fit it all together. Build up from something that works.

You may want to take a look at the automatic recalc option for Fit Y by X. It's under "script" in the Bivariate red triangle pulldown. It might relieve you of the need to build your own redisplay.

I would recommend testing out each piece of your code separately to see if it does what you want. Then worry about how to fit it all together. Build up from something that works.

You may want to take a look at the automatic recalc option for Fit Y by X. It's under "script" in the Bivariate red triangle pulldown. It might relieve you of the need to build your own redisplay.

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

Re: Bivarite Plot - Obtaining a Combined Data Table

Thanks mpb for all your anwsers. I'm still struggling on this issue. I will use a simple example to describe what I need. I have an original table (e.g. Product, Year, N_Sold, N_Return). In the graph, I want to have a filter for the year ( I can make this work) and a bivariate graph of Sum(N_Return) vs Sum(N_Sold) by group Product.

If I select the different year in the filter, I want to see the graph will be updated with the selection. I know the graph can't summarize the data, so I think to create a intermediate table by script to summarize the data (I can make this work) and the graph to get data from this intermediate table (don't know how to do this).

what is the way to make this work?

If I select the different year in the filter, I want to see the graph will be updated with the selection. I know the graph can't summarize the data, so I think to create a intermediate table by script to summarize the data (I can make this work) and the graph to get data from this intermediate table (don't know how to do this).

what is the way to make this work?

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

Re: Bivarite Plot - Obtaining a Combined Data Table

Ok, I think this has a nice solution.

Create the working summary table from the original table

1. Make the year column Nominal

2. Table > Summary

3. Year --> Group

4. Product --> Group

5. Sum(N_Return) --> Statistics

6. Sum(N_Sold) --> Statistics

7. Click Ok.

This gives you a summary table sorted by Year, then by Product. The columns are Year, Product, Sum(N_Return), and Sum(N_Sold).

With the summary table current create straight line fits for each year in one plot:

8. Analysis > Fit Y by X

9. Sum(N_Sold) --> X

10. Sum(N_Return) --> Y

11. Click Ok.

12. From the Bivariate red triangle pulldown click Group By

13. From the resulting list choose Year

14. Click Ok

15. From the Bivariate red triangle pulldown click Fit Line

You will then see straight line fits for all years with a legend identifying them by year.

Enable automatic recalculation:

16. From the Bivariate red triangle pulldown click Script > Auto Recalc

Now create the data filter (this could have been done before Fit Y by X):

17. Rows > Data Filter

18. From the resulting list select Year and click Ok

19. You will now see a filter with buttons for each year.

20. Uncheck Select

21. Check Show

22. Check Include

Now if you click a year button in the data filter, only the data and straight line fit for that year will be shown. What's more, if you want to compare 2 or more, then Ctl-Click additional buttons and only the data for them and the related fit lines will be shown.

This whole thing can be scripted.

Create the working summary table from the original table

1. Make the year column Nominal

2. Table > Summary

3. Year --> Group

4. Product --> Group

5. Sum(N_Return) --> Statistics

6. Sum(N_Sold) --> Statistics

7. Click Ok.

This gives you a summary table sorted by Year, then by Product. The columns are Year, Product, Sum(N_Return), and Sum(N_Sold).

With the summary table current create straight line fits for each year in one plot:

8. Analysis > Fit Y by X

9. Sum(N_Sold) --> X

10. Sum(N_Return) --> Y

11. Click Ok.

12. From the Bivariate red triangle pulldown click Group By

13. From the resulting list choose Year

14. Click Ok

15. From the Bivariate red triangle pulldown click Fit Line

You will then see straight line fits for all years with a legend identifying them by year.

Enable automatic recalculation:

16. From the Bivariate red triangle pulldown click Script > Auto Recalc

Now create the data filter (this could have been done before Fit Y by X):

17. Rows > Data Filter

18. From the resulting list select Year and click Ok

19. You will now see a filter with buttons for each year.

20. Uncheck Select

21. Check Show

22. Check Include

Now if you click a year button in the data filter, only the data and straight line fit for that year will be shown. What's more, if you want to compare 2 or more, then Ctl-Click additional buttons and only the data for them and the related fit lines will be shown.

This whole thing can be scripted.

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

Re: Bivarite Plot - Obtaining a Combined Data Table

Here is a scripted example where the Fitness data is assumed current (e.g. this script could be embedded in the table). It pretends that each Name has multiple occurences as would Product, and Sex takes the place of Year.