问题
您在 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,伊莱