我正在编写一个脚本,该脚本循环遍历 Y 响应列表并对每个响应运行降级(稳定性测试),然后将报告的各个部分输出到组合数据表。它包括以下步骤:
- 打开一个对话框,用户可以在其中选择几个“Y、响应”、“时间”和“标签、系统 ID”。
- 对于每个“Y,响应”,脚本循环并运行退化稳定性测试,将“模型比较”信息输出到报告中。
- 将报告连接到主表中。
我已包含代码来获取每个循环的 y 列的名称并将其作为新列添加到每个报告中,然后将每个报告连接到新的主表。各个报告和“combinedDataTable”都有新列(“源 Y 列”);但是,它不会用相应的列名填充单元格。脚本运行良好且没有错误。我在下面包含了一些屏幕截图。有问题的代码位于脚本的末尾。
// Initialize an empty data table to store combined results
combinedDataTable = New Table( "Combined Degradation Data" );
// Loop through each selected Y column and perform degradation analysis
For( i = 1, i <= N Items( YCols ), i++,
currentYCol = Column( dt, YCols[i] );
// Calculate the min and max values of the current Y column
minValue = Col Minimum( currentYCol );
maxValue = Col Maximum( currentYCol );
// Adjust the min and max values by 2%
adjustedMin = minValue * 0.98;
adjustedMax = maxValue * 1.02;
// Determine the increment value based on the highest value
If( maxValue < 5,
incValue = 0.25,
If( maxValue > 5 & maxValue < 15,
incValue = 0.25,
If( maxValue > 90,
incValue = 0.5,
incValue = (adjustedMax - adjustedMin) / 10
)
)
);
//Determine the X Scale Box Based on Number of Timepoints
maxTimepoint = Col Maximum( Column( dt, XCols[1] ) );
adjustedMaxTimepoint = maxTimepoint + 1;
// Perform Degradation Analysis
degReport = dt << Degradation(
Y( currentYCol ),
Time( Column( dt, XCols[1] ) ), // Assuming only one X column is selected
Label( Column( dt, BCols[1] ) ), // Assuming only one By column is selected
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 ),
Inverse Prediction Interval( "Confidence Interval" ),
Inverse Prediction Alpha( 0.05 ),
Inverse Prediction Side( "Lower One Sided" ),
SendToReport(
Dispatch( {"Overlay"}, "1", ScaleBox, {Min( -1 ), Max( adjustedMaxTimepoint ), Inc( 6 ), Minor Ticks( 1 )} ),
Dispatch(
{"Overlay"},
"2",
ScaleBox,
{Format( "Fixed Dec", 12, 1 ), Min( adjustedMin ), Max( adjustedMax ), Inc( incValue ), Minor Ticks( 0 )}
)
)
);
// Extract the data from the specified location
extractedData = Report( degReport )["Degradation Data Analysis"]["Overlay"]["Stability Tests"][Table Box( 2 )] << Make Combined Data Table;
// Add a column to indicate the source Y column
currentYColName = Column( dt, YCols[i] ) << Get Name;
extractedData << New Column( "Source Y Column", Character, "Nominal", Set Values( Repeat( currentYColName, N Rows( extractedData ) ) ) );
// Combine the extracted data into the combined data table
combinedDataTable << Concatenate( extractedData, Append to first table( 1 ) );
// Close the individual report window
Close( Window( degReport ) );
);
// Show the combined data table
combinedDataTable << Show Window;
笔记:
这是其中一个退化分析的输出窗口。我提取了红色轮廓中的信息。

这是包含两个 Y 响应的主输出表,但“源 Y 列”尚未填充。

如果要为每一行设置相同的值,则可以使用设置每个值
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
mystr = "ABC";
dt << New Column("X", Character, Set Each Value(mystr));