如何编写分组依据以处理灵活的分组数量你好,
致力于自动化分析,需要使自动生成的脚本更具通用性。
工作流程是创建一个汇总表,该表由三列组成,其中四列获取派生值。 那样就好。
现在,我想用原始分组变量之一创建单向图,然后再用第二个变量对图进行分组。
分组:循环,步骤,唯一步骤
4个单独的“单周期循环”分组的步骤。
自动生成的脚本可以在我的测试文件上正常运行。 问题是如何使其更通用。
如果我看一下脚本,则有针对步骤列值的特定标注
<< {在行中排列(4)},Where(:Step == 1),Where(:Step == 1))
在测试用例中,step有19个值。 我应该如何精心设计以适应步骤数? 各种文件将具有不同数量的步骤。 什么是最佳做法? 我希望得出的结果是将四个图连续放置,并在分组框中同时显示步骤的值(现在在图之后以小文本显示),并自动设置传入文件可能具有的步骤数。
安迪
dt1=Data Table( dt) <<SUMMARY></SUMMARY>
脚本编写回复:如何编写分组依据脚本以处理灵活的分组数量取得了一些进展。
可以通过使用“按”运算符来处理大量工作。
仍然缺少的是如何将组以4组为单位进行排列,因此每个组的图都在同一行上。
有什么想法吗
安迪
view = dt1 << Oneway(
Y( {:"Min(TV Pres (torr))"n ,:"Min(DS Pres (torr))"n,:"Max(TV Pres (torr))"n, :"Max(DS Pres (torr))"n}),
X( :Cycle ),
by (:Step),
Quantiles( 1 ),
Means( 1 ),
Mean Diamonds( 0 ),
Box Plots( 1 ),
X Axis Proportional( 0 ),
Points Jittered( 1 ),
Grand Mean( 0 ),
SendToReport(
Dispatch( {}, "Quantiles", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Oneway Anova", OutlineBox, {Close( 1 )} ),
Dispatch( {"Oneway Anova"}, "Analysis of Variance", OutlineBox, {Close( 1 )} )
)
);回复:如何编写分组依据脚本以处理灵活的分组数量下面是一个示例,将4个图形放在一行中,并为分析中指定的每一列添加了一行

Names Default To Here( 1 );
dt1 = Open( "$SAMPLE_DATA\big class.jmp" );
// restrict to 4 ages to match the 4 level requirement
dt1 << select where( :age >= 16 );
dt1 << delete rows;
// Create a window to place the output in
nw = New Window( "test", lub = Lineup Box( N Col( 4 ) ) );
// Run the analysis with a By clause
view = dt1 << Oneway(
invisible,
Y( :height, :weight ),
X( :sex ),
Quantiles( 1 ),
Means( 1 ),
Box Plots( 1 ),
Mean Diamonds( 1 ),
by( :age ),
SendToReport(
Dispatch( {}, "Quantiles", OutlineBox, {Close( 1 )} ),
Dispatch( {}, "Oneway Anova", OutlineBox, {Close( 1 )} ),
Dispatch( {"Oneway Anova"}, "Analysis of Variance", OutlineBox, {Close( 1 )} )
)
);
// Take the elements from the outout and place in the window
// The display produces all levels of the by across one level
// of by group and then moves onto the next by group. Therefore
// the displays need to be picked across the full range of outputs
// to get the four grqaphs aligned
numCols = N Items( view ) / 4;
For( col = 1, col <= numCols, col++,
For( theRow = 1, theRow <= 4, theRow++,
lub << append( Report( view[(theRow - 1) * numCols + col] ) );
i++;
)
)
;