我想知道如何獲得匯總表但有額外的統計數據。
例如,模式()是一個可以在公式中使用的函數,但這不起作用:
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。
請讓我們知道它是否有效或需要改進。
羅恩
我正在測試這種方法,恐怕這是不可行的。
在重新組合大表(半百萬行和數百列)中的許多項目時,JMP 使用顯示分佈的時間太長。
相反,匯總表中的默認函數的計算速度非常快。