I prepared this script for internal discussions about Outlier Screening in Jmp.
It shows most of the aspects and can be used as a starting point for further development of workarounds ...
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "dummy", Nominal );
dt << New Column( "alien", Nominal );
:alien[12] = 1;
:sex[12] = "";
:alien[39] = 1;
New Window( "alien screeing",
<<Show Menu( 0 ),
<<ShowToolbars( 0 ),
H List Box(
V List Box(
Button Box( "shuffle",
students = Loc( dt[0, "dummy"], . );
dt[students, "alien"] = J( N Items( students ), 1, If( Random Integer( 100 ) < 5, 1, . ) );
),
Button Box( "no aliens today",
students = Loc( dt[0, "dummy"], . );
dt[students, "alien"] = J( N Items( students ), 1, . );
),
Button Box( "- 1 student", dt << Select Rows( Random Integer( N Rows( Current Data Table() ) ) ) << Delete Rows ),
Button Box( "- Linda", dt << Select Rows( Loc(dt[0,"name"],"LINDA") ) << Delete Rows ),
Button Box( "add dummys",
For( myAge = 12, myAge <= 17, myAge++,
dt << add rows( {:name = "xxx", :age = myAge, :dummy = 1, :alien = 1} )
)
),
Button Box( "remove dummys", dt << Select Rows( Loc( dt[0, "alien"] ) ) << Delete Rows ),
Tabulate(
Show Control Panel( 0 ),
Include missing for grouping columns( 1 ),
Add Table( Row Table( Grouping Columns( :dummy, :name, :age, :sex, :alien ) ) )
)
),
V List Box(
Data Filter Context Box(
Panel Box( "my subset",
<<Background color( -12040119 ),
H List Box(
dt << Data Filter( Local, Add Filter( columns( :age, :sex ), Where( :age == 17 ) ) ),
dt << Graph Builder(
title( "students/age" ),
Show Control Panel( 0 ),
Size( 300, 300 ),
Show Legend( 0 ),
Fit to Window,
Variables( X( :age ) ),
Elements( Bar( X, Legend( 7 ), Bar Style( "Stacked" ), Summary Statistic( "N" ) ) ),
Local Data Filter(Count Excluded Rows( 0 ), Add Filter( columns( :dummy ) ) ),
SendToReport( Dispatch( {}, "", ScaleBox, {Min( 0 ), Max( 15 ), Inc( 1 ), Minor Ticks( 0 )} ) )
)
,
dt << Tabulate(
Title( "Aliens in the subset" ),
Show Control Panel( 0 ),
Include missing for grouping columns( 1 ),
Add Table( Row Table( Grouping Columns( :alien, :age, :name ) ) ),
Local Data Filter(Count Excluded Rows( 0 ), Add Filter( columns( :alien ), Where( :alien == 1 ) ) )
)
)
)
),
dt << Graph Builder(
title( "all my aliens" ),
Size( 700, 350 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :age ) ),
Elements( Bar( X, Legend( 7 ), Summary Statistic( "N" ) ) ),
Local Data Filter( Add Filter( columns( :alien, :dummy ), Where( :alien == 1 ) ) )
),
dt << Graph Builder(
title( "all students" ),
Size( 700, 350 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :age ) ),
Elements( Bar( X, Legend( 7 ), Summary Statistic( "N" ) ) ),
Local Data Filter( Add Filter( columns( :dummy ) ) )
)
)
),
<<OnClose( Close( dt, NoSave ) )
);