你好,
我正在寻找一个简单的东西:数组的中位数。
我发现表格、汇总表等复杂的东西......但我需要更简单的:
假设我有一个数组(矩阵)A:
A = 1::10;
如何获取A的媒体?
谢谢。
使用斯坦分位数方法,将公式添加到中位数柱子:
New Table( "Utility Data",
New Column( "Consumption", Character, "Nominal", Set Values( {"Electricity", "Gas"} ) ),
New Column( "Monday", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [11.2, 100.4] ) ),
New Column( "Tuesday", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [10.4, 86.9] ) ),
New Column( "Wednesday", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [13, 94.8] ) ),
New Column( "Thursday", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [7.1, 103] ) ),
New Column( "Friday", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [12.4, 112.3] ) ),
New Column( "Saturday", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [11.9, 95.3] ) ),
New Column( "Sunday", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [9.7, 97.8] ) ),
New Column( "Median", Numeric, "Continuous", Format( "Best", 12 ),
// the 2nd argument to the quantile function is a matrix made from the days of the row...
formula( Quantile( 0.5, monday || tuesday || wednesday || thursday || friday || saturday || sunday ) )
)
)
column formula using Quantile to get Mediancolumn formula using Quantile to get Median使用分位数获取中位数的列公式
谢谢 !
我猜@uday_guntupalli明白我的意思了:)和@斯坦_科普罗夫斯基得到了解决方案。
事实上,我一直在寻找矩阵的中位数,因为我无法立即从表中提取它,但也许你可以引导我找到一种方法:
我有一张桌子(如下所示)。 我想以一种简单的方式计算每行的中位数。 当然,我需要从计算中排除第一列。 在 Excel 中它很简单,但在 JSL-JMP 中,我不知道如何简单地做到这一点(避免堆叠表格,...)。
表格示例:
消费量 周一 周二 周三 周四 周五 周六 周日 中位数
电力 11.2 10.4 13.0 7.1 12.4 11.9 9.7 ?
气体 100.4 86.9 94.8 103.0 112.3 95.3 97.8
你好@uday_guntupalli ,
您可以对矩阵执行相同的操作,如下所示 -
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
htmat = :height<<GET as="" matrix=""></GET>
//输出
{500, 63, 5.5}
干杯,
斯坦
@斯坦_科普罗夫斯基,
当我想到这个的时候,我想@萨米尔问,如何对于不是来自数据表的矩阵计算出相同的值? 我查看了脚本索引,似乎没有直接的方法来计算矩阵的分位数或中位数(除非我错过了)
你好@萨米尔,
您可以在不带或带 by 变量的情况下使用分位数函数,如下例所示。
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Row() = 1;
median_ht = Col Quantile( :height, 0.5 );
Row() = 1;
median_htbyage = Col Quantile( :height, 0.5, :age );
Show( median_ht ); //Show median height
Show( median_htbyage ); //Show median height by age<BR /><BR /><BR />
Col Median FunctionCol Median Function列中值函数
干杯,
斯坦