Hi All,
I would like to make a script for reliability estimation. One of my tasks is to evaluate the estimated quantile/probability.
In these expressions (please see the code below), if I list all the categories explicitly using list, such as {0, 1, 2, 3}, the expression works fine. However, if I use the variable for the list, then use the variable instead of explicitly writing the list in the code, the expression does not work.
Here is an example.
The following code works fine:
Lognormal Estimate Probability( Profile, {1000}, {0 ,1, 2, 3} )
The following code does not work:
list_Category_num = {0 ,1, 2, 3}
Lognormal Estimate Probability( Profile, {1000}, list_Category_num )
I tried searching this forum and so far, try to use commands such as "eval()", "eval list()", "eval expr()", but the problem still persist.
Below is the full body of the code:
Fit Life by X(
// Set distribution and parameters
Distribution( Lognormal ),
Nested Model Tests( Location and Scale ),
Y( :ResponseVariable ),
X( :Category ),
Censor( :Censor ),
Censor Code( 1 ),
// Fit Lognormal and set confidence interval
<<Fit Lognormal,
<<Confidence Level( 0.95 ),
for(i = 1, i <= N_Category, i++,
<<Add Density Curve to Scatterplot(i),
),
<<Add Quantile Line to Scatterplot( 0.05 ),
<<Add Quantile Line to Scatterplot( 0.5 ),
<<Add Quantile Line to Scatterplot( 0.95 ),
Show Density Curves( 1 ),
Use Transformation Scale( 0 ),
Show Overlay by Levels( 1 ),
<<Set Scale(
Lognormal,
Simultaneous,
Show Nonparametric CI( 0 ),
Show Parametric CI( 1 )
),
<<Set Scriptables(
{Distribution Comparisons(
Profiler(
1,
Confidence Intervals( 1 ),
Term Value(
Category( list_Category[1], Lock( 0 ), Show( 1 ) ),
ResponseVariable( 1000, Min ( 0 ), Max( 3000 ), Lock( 0 ), Show( 1 ) ),
{Label Row( Label Orientation( "Angled" ) )}
)
)
),
// ======================================================================================================
// =============================== BEGIN OF THE PART RELATED TO QUESTION ===============================
// ======================================================================================================
list_Category_num = {0 ,1, 2, 3}
Lognormal Estimate Quantile( Profile, {0.001}, {0 ,1, 2, 3} ), // PASSED: Writing list explicitly as {0, 1, 2, 3} works fine
Lognormal Estimate Probability( Profile, {1000}, list_Category_num ) // FAILED: Using variable for list {0, 1, 2, 3} does not work
// =====================================================================================================
// ================================ END OF THE PART RELATED TO QUESTION ================================
// =====================================================================================================
}
),
Confidence Interval Method( Likelihood ),
SendToReport(
Dispatch(
{"Nonparametric Overlay"},
"1",
ScaleBox,
{
Min( 1 ),
Max( 1000 ),
Inc( 1 ),
Minor Ticks( 0 ),
Add Ref Line( 100, "Dotted", "Black", "", 1 )
}
),
Dispatch(
{"Scatterplot"},
"1",
ScaleBox,
{Label Row( Label Orientation( "Angled" ) )}
),
Dispatch(
{"Results", "Lognormal Results", "Distribution Profiler"},
"1",
ScaleBox,
{Min( 0 ), Inc( 1 ), Minor Ticks( 0 ),
Label Row( Label Orientation( "Angled" ) )}
)
)
);
Thank you very much for your help.