My team frequently uses the Degradation Stability Test analysis to determine the predicted (95% confidence) values and upper and lower bounds for a response (y value). At this point we've been running the degradation stability test for each y variable (same series of x time point values) and then manually changing the longitudinal prediction time, saving the predictions into a new data window and then extracting the predicted, upper, and lower bound values into a separate Excel file. I'm trying to write a script that can run the stability test for a number of pre-selected longitudinal prediction time points and save all of the data (predicted value, upper, and lower bound values) into a new data table. However, I keep running into errors and I'm not sure whether what I'm trying to achieve is possible in the current version of JMP (v17.1.1). I've attached my script below.
// Use the current data table
dt = Current Data Table();
// Define the longitudinal prediction times
longitudinalPredictionTimes = {18, 24, 36, 48, 60};
// Create a new data table to store the results
resultsTable = New Table( "Prediction Results",
Add Rows( N Items( longitudinalPredictionTimes ) ),
New Column( "Prediction Time", Numeric, "Continuous" ),
New Column( "Prediction", Numeric, "Continuous" ),
New Column( "Lower Bound", Numeric, "Continuous" ),
New Column( "Upper Bound", Numeric, "Continuous" )
);
// Loop through each prediction time and perform the degradation analysis
For( i = 1, i <= N Items( longitudinalPredictionTimes ), i++,
predictionTime = longitudinalPredictionTimes[i];
// Perform degradation analysis
degradationReport = dt << Degradation(
Y( :"Purity (%)" ),
Time( :"Timepoint (days)" ),
Label( :Formulation ),
Application( Stability Test ),
Connect Data Markers( 0 ),
Show Fitted Lines( 1 ),
Show Spec Limits( 1 ),
Show Median Curves( 0 ),
Show Legend( 1 ),
No Tab List( 0 ),
Use Pooled MSE for Nonpoolable Model( 0 ),
Set Censoring Time( . ),
Show Residual Plot( 1 ),
Show Inverse Prediction Plot( 1 ),
Show Curve Interval( 1 ),
Longitudinal Prediction Time( predictionTime ),
Longitudinal Prediction Interval( Confidence Interval ),
Longitudinal Prediction Alpha( 0.05 ),
Inverse Prediction Interval( Confidence Interval ),
Inverse Prediction Alpha( 0.05 ),
Inverse Prediction Side( Lower One Sided )
);
// Extract the prediction, lower bound, and upper bound from the report
predictionPlot = degradationReport[Outline Box( "Diagnostics and Predictions" )][Outline Box( "Prediction Plot" )];
prediction = predictionPlot[Number Col Box( "Predicted value of Purity (%) at Timepoint (days)=" || Char( predictionTime ) )][1];
lowerBound = predictionPlot[Number Col Box( "Lower 95% Confidence Limit" )][1];
upperBound = predictionPlot[Number Col Box( "Upper 95% Confidence Limit" )][1];
// Add the results to the new table
resultsTable:Prediction Time[i] = predictionTime;
resultsTable:Prediction[i] = prediction;
resultsTable:Lower Bound[i] = lowerBound;
resultsTable:Upper Bound[i] = upperBound;
);
// Show the results table
resultsTable << Show Window