Subscribe Bookmark RSS Feed

Bivarite Plot - Obtaining a Combined Data Table

notsonimble

Community Trekker

Joined:

Jun 23, 2011

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))}))
);
10 REPLIES
mpb

Super User

Joined:

Jun 23, 2011

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
notsonimble

Community Trekker

Joined:

Jun 23, 2011

(mpb) That was exactly what I needed... thanks for the help.
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)
)
)
)
mpb

Super User

Joined:

Jun 23, 2011

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.
How about I create a outline box with a update button. When the button is clicked, the table box inside the outline box will be updated with a new bivariate graph. I have run this script and it didn't work. But I want to know if you think this idea will work. Thanks for any effort.


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);

);
mpb

Super User

Joined:

Jun 23, 2011

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.
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?
mpb

Super User

Joined:

Jun 23, 2011

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.
mpb

Super User

Joined:

Jun 23, 2011

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.