Clear Globals(); dlg = Column Dialog( yCol = Col List( "Variable", Data Type( Numeric ), Min Col(1), Max Col(2) ), Line Up( 2, //"Degree of Confidence", j = Edit Number( .95 ), "Number of Samples", k = Edit Number( 100 ) ), V List( "Demonstration", demo = Radio Buttons( "Test Single Mean", "CompareTwo Means" ) ), "", "Select columns for resampling demonstration" ); If( dlg["Button"] == -1, Throw( "User cancelled" ) ); Remove From( dlg ); Eval List( dlg ); If( demo == 2 & N Items( yCol ) != 2, Dialog( "Only one column provided to compare two means", "", Button( "OK" ) ); Throw( "Only one column provided to compare two means" ); ); dt = Current Data Table(); nn = N Row(); // create containers for resampling results. m = J( k, 1, . ); // get 'population'. y = dt << Get As Matrix( yCol ); // collect sample statistics. Choose( demo, // test one mean. y1 = y[0,1]; // just use the first column. For( s = 1, s <= k, s++, m[s] = Mean( y1[ J( nn, 1, Random Integer( nn ) ) ] ); ), // compare two means. y1 = y[0,1]; y2 = y[0,2]; // just use the first column. For( s = 1, s <= k, s++, m[s] = Mean( y2[ J( nn, 1, Random Integer( nn ) ) ] ) - Mean( y1[ J( nn, 1, Random Integer( nn ) ) ] ); ); ); // save and show the statistics. rdt = New Table( "Resample Results", New Column( "Sample", Values( 1::k ) ), New Column( "Mean", Values( m ) ), New Column("Probability"), New Column("Quantile") ); Quantile<