Dear All,
I'm updating a script that I wrote some time ago. You can find the original script/idea here. The original script was meant to update some basic statistical information as a user clicks through the columns listed in the "Select Columns" Panel Box of the current data table.
What I'd like to do now is add some panel boxes that also update when the user clicks on the different columns available from the current data table. I want to update a panel box that shows the distribution of the data within the column -- actually showing the results of the distribution platform (if possible), and not just generating a Graph Builder or Graph Box to do it. The other is a panel box that shows the results of the Explore Outliers platform. I'd like both of these panel boxes to update when the user selects a new column to review.
Using the "Big Class.jmp" example data file, I've made a little mock-up of what I'd like it to show. I've included the JSL at the very end.
This is the current view of the user interface.

This is the concept of how I'd like it to look like when someone clicks on the column of interest, in this case :height.

Then, when the user clicks on a new column, say :weight, the display updates and shows this:

I don't actually need the summary statistics in the distribution platform, but I want the distribution with the box plot and data points graphed above it, with the additional information in the box plot, like the mean, median, and maximum 50% of the data -- you can't add these easily in graph builder, for example.
You don't have to solve this entirely for me, but if anyone has suggestions on how to get started, I'd really appreciate it, because the ideas I've tried so far aren't working. I don't even know if this is possible, but I'm hoping it is. I'd prefer no to have to do it as a dashboard.
Thanks in advance for your help! Below is the JSL
Thanks!,
DS
//GUI for quickly reporting statistics written by D. Schmidt, ver2.0
//Thanks to JMP User community members: jthi, ian_jmp, and ErraticAttach for helpful suggested changes.
Names Default To Here( 1 );
Clear Symbols();
//the width of the column list box in pixels
lbWidth = 200;
dt = Current Data Table();
//dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//List of statistics to calculate
StatsList1 = {"µ", "σ", "Max", "Min", "Range(Δ)", "N"};
StatsList2 = {"µ", "Median", "Mode", "N"};
StatsList3 = {"Quantiles", "5%", "25%", "50%", "75%", "95%", "Int. Q. Range"};
StatsList4 = {"N", "N Missing", "N 0", "Prop 0", "Prop non-0"};
maxStatCount = Max( N Items( StatsList1 ), N Items( StatsList2 ), N Items( StatsList3 ), N Items( StatsList4 ) );
//RadioBox() arguments
rbArg = Eval List(
{Concat Items( StatsList1, ", " ), Concat Items( StatsList2, ", " ), Concat Items( StatsList3, ", " ), Concat Items( StatsList4, ", " )}
);
rbcArg = {"Select for categorical columns"};
//Statistics to Calculate
statMean = Expr( Col Mean( tempCol ) );
statStd = Expr( Col Std Dev( tempCol ) );
statMax = Expr( Col Max( tempCol ) );
statMin = Expr( Col Min( tempCol ) );
statMed = Expr( Col Median( tempCol ) );
statMode = Expr(
Mode( dt:tempcol << getvalues )
);
statRange = Expr(
Col Max( tempCol ) - Col Min( tempCol )
);
statN = Expr( Col Number( tempCol ) );
statQ95 = Expr(
Col Quantile( tempCol, 0.05 )
);
statQ75 = Expr(
Col Quantile( tempCol, 0.25 )
);
statQ50 = Expr(
Col Quantile( tempCol, 0.5 )
);
statQ25 = Expr(
Col Quantile( tempCol, 0.75 )
);
statQ5 = Expr(
Col Quantile( tempCol, 0.95 )
);
statIntQR = Expr( StatQ25 - StatQ75 );
statMiss = Expr(
Col N Missing( tempCol )
);
statZero = Expr(
N Items( Loc( tempCol << get as matrix, 0 ) )
);
statProp0 = Expr( statZero / statN );
statPropn0 = Expr( 1 - statProp0 );
OrdStats = Expr(
colmodeltype = tempCol << Get Modeling type;
If( colmodeltype == "Ordinal",
orddist = dt << Distribution( Nominal Distribution( Column( tempCol ) ), Invisible );
rpt_orddist = orddist << Report;
ordlvl = rpt_orddist[String Col Box( 1 )] << Get;
ordCount = rpt_orddist[Number Col Box( 1 )] << Get;
ordProb = rpt_orddist[Number Col Box( 2 )] << Get;
OrdSummNMiss = rpt_orddist[List Box( 7 )][2] << Get Text;
OrdSummLvl = rpt_orddist[List Box( 8 )][1] << Get text;
OrdnumNMiss = Num( OrdSummNMiss );
OrdnumLvl = Num( OrdSummLvl );
Orddist << Close Window;
);
Insert Into( Ordlvl, {"N Missing", "N Levels"} );
Insert Into( OrdCount, OrdnumNMiss );
Insert Into( OrdCount, OrdnumLvl );
);
CatStats = Expr(
coltype = tempCol << Get Data type;
If( coltype == "Character",
catdist = dt << Distribution( Nominal Distribution( Column( tempCol ) ), Invisible );
rpt_catdist = catdist << Report;
lvl = rpt_catdist[String Col Box( 1 )] << Get;
Count = rpt_catdist[Number Col Box( 1 )] << Get;
Prob = rpt_catdist[Number Col Box( 2 )] << Get;
SummNMiss = rpt_catdist[List Box( 7 )][2] << Get Text;
SummLvl = rpt_catdist[List Box( 8 )][1] << Get text;
numNMiss = Num( SummNMiss );
numLvl = Num( SummLvl );
catdist << Close Window;
);
Insert Into( lvl, {"N Missing", "N Levels"} );
Insert Into( Count, numNMiss );
Insert Into( Count, numLvl );
);
//List for results
StatList = Eval List( {StatsList1, StatsList2, StatsList3, StatsList4} );
StatListRes1 = Expr(
Eval List( {statMean, statStd, statMax, statMin, statRange, statN} )
);
StatListRes2 = Expr(
Eval List( {statMean, statMed, statMode, statN} )
);
StatListRes3 = Expr(
Eval List( {., statQ95, statQ75, statQ50, statQ25, statQ5, StatIntQR} )
);
StatListRes4 = Expr(
Eval List( {statN, statMiss, statZero, statProp0, statPropn0} )
);
StatListRes = Expr(
Eval List( {StatListRes1, StatListRes2, StatListRes3, StatListRes4} )
);
//Expression to handle the distribution platform
DistExpr = Expr(
Distribution(
Continuous Distribution(
Column( tempCol ),
Quantiles( 0 ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Customize Summary Statistics( N Zero( 1 ) )
),
SendToReport( Dispatch( tempCol, "Summary Statistics", OutlineBox, {Close( 1 )} ) )
)
);
//Expression for Outliers
OutlierExpr = Expr(
Explore Outliers( Y( tempCol ), Quantile Range Outliers)
);
//User window
ValueDlg = Expr(
nwin = New Window( "GUI for quick stats",
<<RETURN result=""></RETURN>
Few ideas come to my mind:
- Use Spacer Boxes with Size to force specific sizes to display boxes which store distribution and explore outliers. When user changes to column of interest -> delete old distribution and explore outliers and remake them to same places (append should work here)
- Use hidden column switchers and update the column selection on those when user makes changes in the column listing
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
eo = dt << Explore Outliers(
Y(:weight),
Quantile Range Outliers
);
cs_eo = eo << Column Switcher(
:weight,
{:weight, :height}
);
(Report(eo) << top parent)[Outline Box("Column Switcher")] << Visibility("Collapse");
wait(1);
cs_eo << Set Current("height");
wait(1);
cs_eo << Set Current("weight");Hi @jthi ,
I was actually hoping you'd reply, because I knew I'd get good suggestions, thanks!
Although your suggestions weren't exactly what I was looking for, they gave me some good ideas on how to go about making the changes I was looking to do. I ended up modifying the part in the code for the <
I'm including my code below in case anyone is interested. I'm sure there's other ways to do this, but this was general enough that it is applicable to several different types of data files, so I'm happy with it for now.
Thanks!,
DS
//GUI for quickly reporting statistics written by D. Schmidt, ver2.1<BR />//Thanks to JMP User community members: jthi, ian_jmp, and ErraticAttach for helpful suggested changes.
Names Default To Here( 1 );
Clear Symbols();
//the width of the column list box in pixels
lbWidth = 200;
dt = Current Data Table();
//dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//List of statistics to calculate
StatsList1 = {"µ", "σ", "Max", "Min", "Range(Δ)", "N"};
StatsList2 = {"µ", "Median", "Mode", "N"};
StatsList3 = {"Quantiles", "5%", "25%", "50%", "75%", "95%", "Int. Q. Range"};
StatsList4 = {"N", "N Missing", "N 0", "Prop 0", "Prop non-0"};
maxStatCount = Max( N Items( StatsList1 ), N Items( StatsList2 ), N Items( StatsList3 ), N Items( StatsList4 ) );
//RadioBox() arguments
rbArg = Eval List(
{Concat Items( StatsList1, ", " ), Concat Items( StatsList2, ", " ), Concat Items( StatsList3, ", " ), Concat Items( StatsList4, ", " )}
);
rbcArg = {"Select for categorical columns"};
//Statistics to Calculate
statMean = Expr( Col Mean( tempCol ) );
statStd = Expr( Col Std Dev( tempCol ) );
statMax = Expr( Col Max( tempCol ) );
statMin = Expr( Col Min( tempCol ) );
statMed = Expr( Col Median( tempCol ) );
statMode = Expr(
Mode( dt:tempcol << getvalues )
);
statRange = Expr(
Col Max( tempCol ) - Col Min( tempCol )
);
statN = Expr( Col Number( tempCol ) );
statQ95 = Expr(
Col Quantile( tempCol, 0.05 )
);
statQ75 = Expr(
Col Quantile( tempCol, 0.25 )
);
statQ50 = Expr(
Col Quantile( tempCol, 0.5 )
);
statQ25 = Expr(
Col Quantile( tempCol, 0.75 )
);
statQ5 = Expr(
Col Quantile( tempCol, 0.95 )
);
statIntQR = Expr( StatQ25 - StatQ75 );
statMiss = Expr(
Col N Missing( tempCol )
);
statZero = Expr(
N Items( Loc( tempCol << get as matrix, 0 ) )
);
statProp0 = Expr( statZero / statN );
statPropn0 = Expr( 1 - statProp0 );
OrdStats = Expr(
colmodeltype = tempCol << Get Modeling type;
If( colmodeltype == "Ordinal",
orddist = dt << Distribution( Nominal Distribution( Column( tempCol ) ), Invisible );
rpt_orddist = orddist << Report;
ordlvl = rpt_orddist[String Col Box( 1 )] << Get;
ordCount = rpt_orddist[Number Col Box( 1 )] << Get;
ordProb = rpt_orddist[Number Col Box( 2 )] << Get;
OrdSummNMiss = rpt_orddist[List Box( 7 )][2] << Get Text;
OrdSummLvl = rpt_orddist[List Box( 8 )][1] << Get text;
OrdnumNMiss = Num( OrdSummNMiss );
OrdnumLvl = Num( OrdSummLvl );
Orddist << Close Window;
);
Insert Into( Ordlvl, {"N Missing", "N Levels"} );
Insert Into( OrdCount, OrdnumNMiss );
Insert Into( OrdCount, OrdnumLvl );
);
CatStats = Expr(
coltype = tempCol << Get Data type;
If( coltype == "Character",
catdist = dt << Distribution( Nominal Distribution( Column( tempCol ) ), Invisible );
rpt_catdist = catdist << Report;
lvl = rpt_catdist[String Col Box( 1 )] << Get;
Count = rpt_catdist[Number Col Box( 1 )] << Get;
Prob = rpt_catdist[Number Col Box( 2 )] << Get;
SummNMiss = rpt_catdist[List Box( 7 )][2] << Get Text;
SummLvl = rpt_catdist[List Box( 8 )][1] << Get text;
numNMiss = Num( SummNMiss );
numLvl = Num( SummLvl );
catdist << Close Window;
);
Insert Into( lvl, {"N Missing", "N Levels"} );
Insert Into( Count, numNMiss );
Insert Into( Count, numLvl );
);
//List for results
StatList = Eval List( {StatsList1, StatsList2, StatsList3, StatsList4} );
StatListRes1 = Expr(
Eval List( {statMean, statStd, statMax, statMin, statRange, statN} )
);
StatListRes2 = Expr(
Eval List( {statMean, statMed, statMode, statN} )
);
StatListRes3 = Expr(
Eval List( {., statQ95, statQ75, statQ50, statQ25, statQ5, StatIntQR} )
);
StatListRes4 = Expr(
Eval List( {statN, statMiss, statZero, statProp0, statPropn0} )
);
StatListRes = Expr(
Eval List( {StatListRes1, StatListRes2, StatListRes3, StatListRes4} )
);
//User window
ValueDlg = Expr(
nwin = New Window( "GUI for quick stats",
<<RETURN result=""></RETURN>