cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Scripting "make into combined data table" of Fit Life By X with multiple groups

I am trying to build a generic script for Fit Life By X and make into combined data table", as follows:

flx = Fit Life by X(
	Distribution( Weibull ),
	Nested Model Tests( Location and Scale ),
	Y( :Name("Left"), :Name("Right") ),
	X( :d ),
	By(:Name ,:Location,:Street,:Apt,:Number),
	<<Fit Weibull,
	Use Transformation Scale( 0 ),
	Show Overlay by Levels( 1 ),
	<<Set Scale( Weibull, Simultaneous ),
	<<Set Scriptables(
		{Distribution Comparisons(
			Profiler(
				1,
				Confidence Intervals( 1 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					TTF Left( 507.3, Lock( 0 ), Show( 1 ) )
				)
			)
		), Quantile Comparisons(
			Profiler(
				1,
				Confidence Intervals( 1 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Probability( 0.5, Lock( 0 ), Show( 1 ) )
				)
			)
		), Hazard Comparisons(
			Profiler(
				1,
				Confidence Intervals( 0 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					TTF Left( 507.3, Lock( 0 ), Show( 1 ) )
				)
			)
		), Density Comparisons(
			Profiler(
				1,
				Confidence Intervals( 0 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					TTF Left( 507.3, Lock( 0 ), Show( 1 ) )
				)
			)
		), Weibull Distribution(
			Profiler(
				1,
				Confidence Intervals( 1 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					TTF Left( 507.273412168479, Lock( 0 ), Show( 1 ) )
				)
			)
		), Weibull Quantile(
			Profiler(
				1,
				Confidence Intervals( 1 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Probability( 0.5, Lock( 0 ), Show( 1 ) )
				)
			)
		), Weibull Hazard(
			Profiler(
				1,
				Confidence Intervals( 0 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					TTF Left( 507.273412168479, Lock( 0 ), Show( 1 ) )
				)
			)
		), Weibull Density(
			Profiler(
				1,
				Confidence Intervals( 0 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					TTF Left( 507.273412168479, Lock( 0 ), Show( 1 ) )
				)
			)
		), Scatter Plot Show Distribution(
			Weibull( 0 ),
			Lognormal( 0 ),
			Loglogistic( 0 ),
			Frechet( 0 ),
			Exponential( 0 ),
			SEV( 0 ),
			Normal( 0 ),
			Logistic( 0 ),
			LEV( 0 )
		)}
	),
	Confidence Interval Method( Likelihood ),
	SendToReport(
		Dispatch( {"Scatterplot"}, "2", ScaleBox, {Format( "Scientific", 10 )} ),
		Dispatch(
			{"Nonparametric Overlay"},
			"1",
			ScaleBox,
			{Format( "Scientific", 10 )}
		)
	)
);
Wait( 0 );
flx["Fit Life by X - TTF Left BY Discrete (d) Location and Scale  Name=ABC ,Location=XYZ,Street=123,Apt=A12,Number=5099",
	"Results", "Weibull Results", Tab Page Box( 1 ), "Statistics", "Estimates", Table Box( 1 )] << Make Combined Data Table;

 

This generic script will be applied to multiple different data table where the values of all "By" columns will change which makes the line with "....<<Make Combined Data Table" not applicable. 

How do I script to make a generic script for this?

3 REPLIES 3
jthi
Super User

Re: Scripting "make into combined data table" of Fit Life By X with multiple groups

I'm not familiar with Fit Life by X but seems like it provides unnecessary complicated JSL but I'm not sure what could be easily removed. What you want to do, is to find first Weibull results table box for estimates and send the message to that.

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/Devalt.jmp");

flx =  dt << Fit Life by X(
	SendToByGroup({:Status == "Censored"}),
	Distribution(Lognormal),
	Relationship(Arrhenius Celsius),
	Y(:Hours),
	X(:Temp),
	Censor(:Censor),
	Censor Code(1),
	Freq(:Weight),
	<<Fit Lognormal,
	SendToByGroup(
		{:Status == "Censored"},
		<<Fit Weibull,
		<<Time Acceleration Baseline(10)
	),
	SendToByGroup({:Status == "Failed"}, <<Time Acceleration Baseline(40)),
);

dt_weibull = Report(flx)[Outline Box("Weibull Results"), Outline Box("Statistics"), Outline Box("Estimates"), Table Box(1)] << Make Combined Data Table;

If you have JMP17 you could also see what type of box path you can get from properties. Use Properties from toolbar

jthi_1-1707455775647.png

and then find your table box and highlight it

jthi_2-1707455829670.png

Report(platform)["Results","Weibull Results",TabPageBox(1),"Statistics","Estimates",TableBox(1)]

Quickly looking this could be fairly robust option

 

-Jarmo

Re: Scripting "make into combined data table" of Fit Life By X with multiple groups

I tried the following but it is giving me "object not scriptable..." errors

dt = currentdatatable();
dt<<New Column( "d", character, formula("d"));
dt_name = dt<<get name;
// Append "_cleaned" to the name of the data table to create the filename
filename = Char(dt_name) || "_Fit Life By X";

MyWindow = New Window( filename, VertListBox = V List Box() );

rpt=VertListBox << append(
 Fit Life by X(
	Distribution( Weibull ),
	Nested Model Tests( Location and Scale ),
	Y( :Name("Left"), :Name("Right") ),
	X( :d ),
	By(:Name ,:Location,:Street,:Apt,:Number),
	Where(:Number==1),
	<<Fit Weibull,
	Use Transformation Scale( 0 ),
	Show Overlay by Levels( 1 ),
	<<Set Scale( Weibull, Simultaneous ),
	<<Set Scriptables(
		{Distribution Comparisons(
			Profiler(
				1,
				Confidence Intervals( 1 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Left( 507.3, Lock( 0 ), Show( 1 ) )
				)
			)
		), Quantile Comparisons(
			Profiler(
				1,
				Confidence Intervals( 1 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Probability( 0.5, Lock( 0 ), Show( 1 ) )
				)
			)
		), Hazard Comparisons(
			Profiler(
				1,
				Confidence Intervals( 0 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Left( 507.3, Lock( 0 ), Show( 1 ) )
				)
			)
		), Density Comparisons(
			Profiler(
				1,
				Confidence Intervals( 0 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Left( 507.3, Lock( 0 ), Show( 1 ) )
				)
			)
		), Weibull Distribution(
			Profiler(
				1,
				Confidence Intervals( 1 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Left( 507.273412168479, Lock( 0 ), Show( 1 ) )
				)
			)
		), Weibull Quantile(
			Profiler(
				1,
				Confidence Intervals( 1 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Probability( 0.5, Lock( 0 ), Show( 1 ) )
				)
			)
		), Weibull Hazard(
			Profiler(
				1,
				Confidence Intervals( 0 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Left( 507.273412168479, Lock( 0 ), Show( 1 ) )
				)
			)
		), Weibull Density(
			Profiler(
				1,
				Confidence Intervals( 0 ),
				Term Value(
					d( "d", Lock( 0 ), Show( 1 ) ),
					Left( 507.273412168479, Lock( 0 ), Show( 1 ) )
				)
			)
		), Scatter Plot Show Distribution(
			Weibull( 0 ),
			Lognormal( 0 ),
			Loglogistic( 0 ),
			Frechet( 0 ),
			Exponential( 0 ),
			SEV( 0 ),
			Normal( 0 ),
			Logistic( 0 ),
			LEV( 0 )
		)}
	),
	Confidence Interval Method( Likelihood ),
	SendToReport(
		Dispatch( {"Scatterplot"}, "2", ScaleBox, {Format( "Scientific", 10 )} ),
		Dispatch(
			{"Nonparametric Overlay"},
			"1",
			ScaleBox,
			{Format( "Scientific", 10 )}
		)
	)
));

dt_weibull = Report(rpt)[Outline Box("Weibull Results"), Outline Box("Statistics"), Outline Box("Estimates"), Table Box(1)] << Make Combined Data Table;

any idea what might be wrong?

peng_liu
Staff

Re: Scripting "make into combined data table" of Fit Life By X with multiple groups

I am not sure that I understand the problem. I have questions:

Do you have the data table?

Does the above script run?

If the script runs, what is the resulting table, and how is it different from your expectation?

If you are not able to share your data here, please contact support@jmp.com . And we can address it through that channel. Thanks!