Here's an attempt to use a single formula column to perform the Grubb's test (g > g0) and, if an outlier is detected, pinpoint the row with "Yes".
The script creates an example table with a numeric column "Data" and a formula column with Grubb's test at alpha 0.05. The data is from the N(0,1) distribution plus one extreme value (50). Run the script, the extreme should be marked with "yes", and then change one or more numbers in the data column to observe how it affects the output in the formula column.
New Table( "Grubbs",
New Column( "Data", numeric, values( 50 || J( 1, 25, Random Normal( 0, 1 ) ) ) ),
New Column( "Grubbs Outlier Test",
Character,
Formula(
If(
And(
Col Maximum( Col Standardize( :Data ) ) ==
Col Standardize( :Data ),
Col Maximum( Col Standardize( :Data ) ) > ((Col Number( :Data ) -
1) / Sqrt( Col Number( :Data ) )) *
Sqrt(
Abs(
t Quantile(
0.05 / (2 * Col Number( :Data )),
Col Number( :Data ) - 2
)
) ^ 2 / ((Col Number( :Data ) - 2) +
Abs(
t Quantile(
0.05 / (2 * Col Number( :Data )),
Col Number( :Data ) - 2
)
) ^ 2)
)
),
"Yes"
)
)
)
);