我正在編寫一個腳本,該腳本循環遍歷 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));