I am attempting to perform the following with a JMP script:
- Fit Weibull distributions to two different continuous data columns (TBI and TTR) in a table (dt1) BY all the different combinations of two categorical columns in the same table (STNFAM and VIEW_STATE_ID)
- Extract the Alpha and Beta parameters for all the resulting distributions and write them to a table. Even printing them to the log in a parse-able format would work
Here is the current prototype for the script that is intended to just pull the distribution parameters for the first node generated in the report:
******************************************Start of Script
DT1 = currentDataTable();
dist = DT1 <<
Distribution(
By( :STNFAM, :VIEW_STATE_ID ),
Continuous Distribution(
Column( :TBI_HRS ),
Fit Distribution( Weibull with threshold )
),
Continuous Distribution(
Column( :TTR_HRS ),
Fit Distribution( Weibull with threshold )
)
);
//testing to see if dist is a legitimate platform that can be manipulated later on in the script
show properties(dist);
reportDist = dist<<report;
//testing to see if reportDist is a legitimate report that can be manipulated later on in the script
show properties(reportDist);
//testing to see if I can extract Alpha and Beta parameters from just the first node in reportDist
alphaParam = reportDist[Outline Box(1)][Table Box(3)][Number Col Box(1)] << Get(1);
betaParam = reportDist[Outline Box(1)][Table Box(3)][Number Col Box(1)] << Get(2);
//printing the extracted parameters to the log to see if they match the desired values
print(alphaParam);
print(betaParam);
*****************************************************************************End of Script
This script works as expected if dt1 only contains 1 combination of STNFAM and VIEW_STATE_ID. The properties of both "dist" and "reportDist" show up in the log and the Weibull parameters are also printed to the log as desired. However, if more than 1 combination of STNFM and VIEW_STATE_ID is present in dt1, I get the following error and no platform or report properties show up in the log:
****************************************************************************Start of Log
/*:
//:*/
DT1 = currentDataTable();
dist = DT1 <<
Distribution(
By( :STNFAM, :VIEW_STATE_ID ),
Continuous Distribution(
Column( :TBI_HRS ),
Fit Distribution( Weibull with threshold )
),
Continuous Distribution(
Column( :TTR_HRS ),
Fit Distribution( Weibull with threshold )
)
);
//testing to see if dist is a legitimate platform that can be manipulated later on in the script
show properties(dist);
reportDist = dist<<report;
//testing to see if reportDist is a legitimate report that can be manipulated later on in the script
show properties(reportDist);
//testing to see if I can extract Alpha and Beta parameters from just the first node in reportDist
alphaParam = reportDist[Outline Box(1)][Table Box(3)][Number Col Box(1)] << Get(1);
betaParam = reportDist[Outline Box(1)][Table Box(3)][Number Col Box(1)] << Get(2);
//printing the extracted parameters to the log to see if they match the desired values
print(alphaParam);
print(betaParam);
/*:
expected character arg 1 in access or evaluation of 'Outline Box' , Outline Box( 1 )Subscript problem in access or evaluation of 'Subscript' , reportDist[Outline Box( 1 )]
In the following script, error marked by /*###*/
DT1 = Current Data Table();
dist = DT1 << Distribution(
By( :STNFAM, :VIEW_STATE_ID ),
Continuous Distribution(
Column( :TBI_HRS ),
Fit Distribution( Weibull with threshold )
),
Continuous Distribution(
Column( :TTR_HRS ),
Fit Distribution( Weibull with threshold )
)
);
Show Properties( dist );
reportDist = dist << report;
Show Properties( reportDist );
alphaParam = reportDist[/*###*/Outline Box/*###*/(1)][Table Box( 3 )][
Number Col Box( 1 )] << Get( 1 );
betaParam = reportDist[Outline Box( 1 )][Table Box( 3 )][Number Col Box( 1 )] <<
Get( 2 );
Print( alphaParam );
Print( betaParam );
********************************************************************************************End of Log
JMP does not appear to recognize "dist" and "reportDist" as a legitimate platform and report when there is more than one combination generated by the BY arguments in the first section of code. Can anyone point me in the right direction to obtain the desired result?
Attachments:
- Subset_Weibull_Fit_Script.jsl (the script shown in the message above)
- 1_Combo_Subset of XSITE_Weibull_Fit_All_STNFAM_1-10-14.jmp (the testing table on which the script works as expected)
- 2_Combo_Subset of XSITE_Weibull_Fit_All_STNFAM_1-10-14.jmp (the testing table on which the script does not work as expected)
Thank you,