我想知道如何获得汇总表但有额外的统计数据。
例如,模式()是一个可以在公式中使用的函数,但这不起作用:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Summary( Group( :Age ),
subgroup( :sex ),
Mode( :Height )); // Mode isntead of mean我还想通过获取组的最后一个或第一个数字来总结表格。
FWIW(如果你懂一点 JSL),你可以做这样的事情:
Names Default To Here( 1 );
// Sample data
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Invisible Distribution with 'By' group(s)
dist = dt << Distribution(Continuous Distribution(Column( :height ),Customize Summary Statistics(Mode(1))), By(:age, :sex), Invisible);
// Get the Summary Stats
dt2 = Report(dist[1])[TableBox(2)] << makeCombinedDataTable;
Report(dist[1]) << closeWindow;
// Retain only the Mode
dt3 = dt2 << Subset(Rows(dt2 << getRowsWhere(:Column 1 == "Mode")));
dt3 << setName("Mode Values");
Column(dt3, "Column 1") << setName("Statistic");
Column(dt3, "Column 2") << setName("Value");
Close(dt2, NoSave);
我也会考虑JMP愿望清单.
你好@FN ,
即使模式不是表格摘要中的一个选项,也必须有很多方法来获得您所要求的东西。 您可以在分发平台的附加汇总统计表中手动查询Mode,也可以点击as @ian_jmp建议。 否则,请尝试使用 brady_brady 的 add in :
Extended-Summary-Statistics-Add-in-for-JMP这指的是菜单中的模式。
或者,尝试以下脚本:
Names Default To Here( 1 );
// Open Data Table: Big Class.jmp
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// get frequencies for modes
dt2 = dt << Summary(
Group( :Age, :sex, :height ),
Link to original data table( 0 )
);
// delete all rows that are not modes
dt2 << select where( Or( :N Rows != Col Max( :N Rows, :age, :sex ), :N Rows == 1 ) );
dt2 << delete rows;
// indicate first and last values per group - Not min and max unless table is first sorted!!!
dt << New Column( "id age", Numeric, "Continuous", Format( "Best", 12 ), Formula( Sum( :age[Index( 1, Row() )] == :age ) ), eval formula, );
dt:id age << delete formula;
// remove all rows that are not first or last
dt << select where( And( :id age != Col Max( :id age, :age ), :id age != 1 ) );
dt << delete rows;
// create one table with all data and sort it
dt3 = dt << concatenate( dt2, Create source column );
dt3 << New Column( "Value",
Character,
"Ordinal",
Formula( If( :id age == 1, "First", :id age > 1, "Last", :N Rows > 1, "Mode" ) ),
Set Property( "Value Order", {Custom Order( {"First", "Mode", "Last"} ), Common Order( 0 )} ),
);
dt3 << sort( By( :age, :sex, :Value ), Order( Ascending ), replace table );
请注意,在 Big class 的情况下,并非所有 group 都有 clear mode。我的方法是将其删除,最高频率等于 1。
请让我们知道它是否有效或需要改进。
罗恩
使用分发平台作为获取这些的一种方式的好技巧。
我在这里添加了请求。将汇总表函数扩展到任何定义的函数(例如模式、kurt、倾斜等)
我正在测试这种方法,恐怕这是不可行的。
在一个大表(半百万行和数百列)中重新组合许多项目时,JMP 使用显示分布的时间太长。
相反,汇总表中的默认函数的计算速度非常快。