問題
您在 JMP 中運行分析並希望從平台報告中提取一些統計數據。 然後你想把這些統計數據放在一個自定義的報表窗口中,這樣你就可以在數據表和平台報表關閉後保留這些數據。
解決方案
您可以獲得對分析報告的報告層的引用,並使用 JSL 消息從中提取統計信息
在此示例中,生成了一個雙變量平台報告,您將獲得對報告層的引用 (報表). 使用該引用,您可以從雙變量報告中提取變量和字符串。 然後創建一個新的自定義報告窗口並填充從報告中提取的統計信息和字符串。 最後,關閉數據表,從而關閉雙變量報告,但自定義報告窗口保持打開狀態。
Names Default To Here(1);
sd = Open( "$SAMPLE_DATA/Lipid Data.JMP" );
biv = sd << Bivariate( // biv is the analysis layer.
Y( :Triglycerides ),
X( :LDL ),
Density Ellipse( 0.95, {Line Color( {213, 72, 87} )} ),
Fit Line( {Line Color( {57, 177, 67} )} )
);
/* Get a reference to the report layer. */
reportbiv = biv << Report;
// Make sure the "Bivariate Normal Ellipse" outline
// in the Bivariate report is open. You can then see which
// content to extract into the Custom report.
reportbiv[Outline Box( "Bivariate Normal Ellipse P=0.950" )] << Close( 0 );
// Extract the correlation coefficient.
corrvalue = reportbiv[Outline Box( "Bivariate Normal Ellipse P=0.950" )][Number Col Box( "Correlation" )] << Get( 1 );
// Extract the numeric values from the Summary of Fit report as a matrix.
sumfit = reportbiv[Outline Box( "Summary of Fit" )][Number Col Box( 1 )] << Get as Matrix;
// Extract the Term column of the Parameter Estimates report as a list of strings.
term = reportbiv[Outline Box( "Parameter Estimates" )][String Col Box( "Term" )] << Get();
// Extract the Parameter Estimates values as a matrix.
parmests = reportbiv[Outline Box( "Parameter Estimates" )][Table Box( 1 )] << Get as Matrix;
dlg = New Window( "Custom Report",
Outline Box( "Selected Values",
/* The Lineup box defines a two-column layout, each of which contains a Text Box. */
Lineup Box( N Col( 2 ), Text Box( "Factor of Interest: " ), Text Box( term[2] ), ),
tb = Table Box(
/* Display an empty string in the first column and the text in the second column. */
String Col Box( " ", {"Sample Size: ", "Adjusted RSquare: ", "RSquare: ", "Correlation:"} ),
/* Insert a 30 pixel x 30 pixel spacer between the columns. */
Spacer Box( Size( 30, 30 ) ),
/* Display an empty string in the first column and the statistics in the second column. */
Number Col Box( " ", sumfit[{5,2,1}] |/ corrvalue )
),
/* Insert a 1 x 30 spacer. */
Spacer Box( Size( 0, 30 ) ),
Table Box(
/* Display the cloned String Col Box and insert the Parameter Estimates and Standard Error values. */
String Col Box( "Term", term ),
Number Col Box( "Estimate", parmests[0,1] ),
Number Col Box( "Standard Error", parmests[0,2] )
)
)
);
tb << Set Shade Headings( 0 ); // Turn off shaded table headings.
tb << Set Heading Column Borders( 0 ); // Turn off table column borders.
Close( sd ); // Close the data table.
討論
JMP 平台報表包含兩層:平台層和報表層。 如果您有一個引用平台層的 JSL 對象,您可以向該對象發送與分析相關的消息。 這些通常是在紅色小三角菜單中找到的選項。 如果您有一個引用報表層的 JSL 對象,您可以向該對象發送與報表本身相關的消息。 這些消息可以提取值或圖像、更改選擇、打開和關閉輪廓節點以及其他操作。
也可以看看
這篇文章是基於一個JMP 文檔中的示例.
我嘗試遵循此代碼並在不同的報告中使用它。
我的目的是運行多個模型並按照此處顯示的方式在表格中總結重要結果。
Here Is a simple example on a sample dataset 顯示我的目標。
一開始我嘗試提取模型的 P 值。 於是我把第二種模式註釋掉,寫瞭如下代碼:
Open("$SAMPLE_DATA/Detergent.jmp");
Model1 = Fit Model(
Y( :previous use ),
Effects( :softness ),
Personality( "Nominal Logistic" ),
Run(
Positive Level( "yes" ),
Likelihood Ratio Tests( 1 ),
Wald Tests( 1 ),
Odds Ratios( 1 ),
ROC Curve( 1 )
)
);
reportMod = Model1 << Report;
FMchi = reportMod[Outline Box( "Whole Model Test" )][Number Col Box( "Prob>ChiSq" )] << Get( 1 );
dlg = New Window( "Custom Report11",
Outline Box( "Selected Values",
Table Box(
String Col Box( "Pvalue", FMchi )
)
)
);
/*
Model2=Fit Model(
Y( :previous use ),
Effects( :count ),
Personality( "Nominal Logistic" ),
Run(
Positive Level( "yes" ),
Likelihood Ratio Tests( 1 ),
Wald Tests( 0 ),
Odds Ratios( 1 ),
ROC Curve( 1 ),
Logistic Plot( 1 )
)
);我想要的決賽桌是:
屬性 | 整機測試 | R 方 (U) | 否 | 估計 | 概率>卡方 | 優勢比 | AUC |
柔軟度 | 1.000 | 0.000 | 24 | 0 | 1.000 | 1.000 | 0.500 |
數數 | 0.5268 | 0.012 | 24 | 0.0183 | 0.5301 | 1.01847 | 0.5625 |
這是獲得的報告的屏幕截圖,其中我突出顯示了提取的數據。
(在屬性柔軟度中,對於參數估計和優勢比,我只取了日誌的第一行)。




原來的報告窗口出現了,但我什至沒有打開額外的報告窗口。
任何提示都會被應用。
TIA,伊萊