How can I get the name of the best distribution from filtered data?Dear JMP community,
I've only been using JMP for a short time and I still have a lot to learn. I hope you can help me with a problem.
I try to use a data filter to select data for which I want the best distribution fit. Then I would like to have the name of the most suitable distribution from the report:
datafilter1=dt << Data Filter(
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter( columns( :feature) ));
dis=datafilter1<
dis<
theDist = Trim( Word( 3, Report(dis)["Compare Distributions"][String Col Box( 1 )] << get text, "\!n" ) );
The first part works just fine. I can select and display the data using the filter.
But, I only ever get the name of the first distribution when I start the script. If I then select a different data distribution by using the filter, the first name is retained and does not change.
How can you solve the problem? I've already done a lot of research on this, but can't find a solution that would fit. Maybe you can help me. Many Thanks!
ScriptingRe: How can I get the name of the best distribution from filtered data?You need to move your
heDist = Trim( Word( 3, Report(dis)["Compare Distributions"][String Col Box( 1 )] << get text, "\!n" ) );
into a Row State Handler, so that it is recreated every time the filter values are changed
See: Make Rowstate HandlerRe: How can I get the name of the best distribution from filtered data?Hello,
thank you for your answer.
But what should the function look like that I need for the "Make Rowstate Handler" ? I tried this:
f = Function( {a},
Trim( Word( 3, Report( dis )["Compare Distributions"][String Col Box( 1 )] << get text, "\!n" ) )
);
rs = dt << Make Row State Handler( f );
But it doesn't work. What am I doing wrong? Thank you!
Re: How can I get the name of the best distribution from filtered data?Here is a working sample, pulling the value of "theDist" each time the Data Filter changes
names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
datafilter1 = dt << Data Filter(
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter( columns( :site ) )
);
dis = dt<< Distribution( Automatic Recalc( 1 ), Column( :npn1 ) );
dis << Fit Distribution( All );
theDist = Trim( Word( 3, Report( dis )["Compare Distributions"][String Col Box( 1 )] << get text, "\!n" ) );
f=Function({a}, theDist = Trim( Word( 3, Report(dis)["Compare Distributions"][String Col Box( 1 )] << get text, "\!n" ) ); show(theDist));
rs=dt<<MAKE row="" state="" handler=""></MAKE>