问题标签 [percentile]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
5620 浏览

performance - Perl:计算百分位数的最有效方法

我有一个 perl 脚本,它通过几个 gig 的文件并生成一个报告。

为了计算百分位数,我正在执行以下操作

这显然将所有值预先保存在一个数组中,然后计算百分位数,这可能会占用大量内存(假设有数百万个值),是否有更高效的内存方式来执行此操作?

0 投票
1 回答
795 浏览

matlab - 使用 MATLAB 查找多天的第 90 个百分位温度超标

我正在做一个项目,我试图找到温度超过 90% 的多日事件。

我正在使用 61 年的数据并尝试根据 6 月至 8 月之间的每个月计算百分位数。换句话说,使用该prctile函数,我想计算 6 月、7 月和 8 月的第 90 个百分位,并根据该月的第 90 个百分位值比较每个月的每日温度值。

最终,我希望程序根据该月的值找到温度超过第 90 个百分位值的日期字符串(2 天、3 天、4 天、5 天等)。

以下是我到目前为止的代码:

我不知道如何让程序计算每个月的第 90 个百分位(而不是 6 月至 8 月的整个 3 个月范围)。

此外,我不知道如何让程序找到温度超过 90% 的日期字符串,特别是因为 4 天事件还包括 3 天事件和 2 天事件。

我知道需要一些 if/else 语句,但我不确定如何设置它。

0 投票
3 回答
6964 浏览

r - ggplot中基于​​百分位的颜色代码点

我有一些非常大的文件,其中包含基因组位置(位置)和相应的群体遗传统计数据(值)。我已经成功绘制了这些值,并希望对前 5%(蓝色)和 1%(红色)的值进行颜色编码。我想知道在 R 中是否有一种简单的方法可以做到这一点。

Fst 值

我已经探索过编写一个定义分位数的函数,但是,其中许多最终不是唯一的,因此导致函数失败。我也研究了 stat_quantile 但只成功地使用它来绘制一条标记 95% 和 99% 的线(有些线是对角线,对我来说没有任何意义。)(对不起,我是新手R.)

任何帮助将非常感激。

这是我的代码:(文件非常大)

0 投票
3 回答
5827 浏览

mongodb - 如何计算百分位数?

我有如下访问日志存储在 mongodb 实例中:

是否有像PERCENTILE_DISCOracle 中的分析功能来计算百分位数?

我想计算一段时间内的延迟百分位数。

0 投票
3 回答
69004 浏览

python - 消除给定百分位数上的所有数据

我有一个DataFrame名为pandasdata的列,名为ms. 我想消除所有data.ms高于 95% 的行。现在,我正在这样做:

哪个有效,但我想将其推广到任何百分位数。最好的方法是什么?

0 投票
2 回答
1458 浏览

r - 新列中行的百分比值

我的数据集是 y。我有一个 ID 和 Sales 列。我想添加一个 3 列,其中包含每个员工基于其销售额的百分位数。

百分位数的公式是:

谢谢

0 投票
3 回答
226 浏览

php - 使用 php 和 joomla 2.5 检索百分位排名

我一直在尝试根据分数获得用户的百分等级。我可以在 phpmyadmin 中获得结果 - 但似乎无法在 php 中获得正确的代码......

这是我到目前为止所拥有的......

但是 - 我一直卡在如何加载结果......

意思是如何从查询中加载结果.....

任何帮助将不胜感激...

0 投票
2 回答
700 浏览

php - 计算大型数据库的百分位数

我有一个庞大的数据库,其中包含有关测试代码的学生信息以及这些测试代码所获得的分数。我需要为每个测试代码对应的学生重新计算百分位数。我有一系列测试代码的代码,但它不能正常工作。

0 投票
2 回答
2332 浏览

python - python: numpy - 用线性插值计算百分位数

我在阅读维基百科后尝试计算百分位数我实现了简单的公式

但我想做的是wiki中提到的插值版本:(http://en.wikipedia.org/wiki/Percentile#Linear_interpolation_between_closest_ranks)我在谷歌搜索并找到了numpy,但我认为我没有得到正确的即使是简单的公式,我也使用它时的价值。当我尝试传入值来进行插值时,它给了我错误。(http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.percentile.html

让我们从以下列表开始:

根据我的方法:我得到了代表我正在寻找的百分位数的原始列表的实际值:

但是,如果我使用 numpy,我不会得到代表原始列表的实际值。

我的问题是一个数组,如何通过使用线性插值技术计算百分位数,从该数组中获取表示百分位数(例如 10、20...100)的值?

0 投票
1 回答
284 浏览

r - New complexity to color coding based on percentile and another factor in ggplot

I would like to add another level of complexity to the color coding scheme I have going on in the below plot. I want to account for whether each of the values being plotted has passed a statistical test. So, the dots will only be color coded based on the percentile if they pass the test, otherwise, I would like the dot to be grey.

Here is my code as I have it after all the helpful suggestions I received from my first post Color code points based on percentile in ggplot (note: this is some made up data, though I have real data which has many more entries:

My problem is in the line: dat$col <- with(dat, factor(ifelse(fet < 1.30102999566398, 3, quant))). I want it to use the value from the $quant if it has an $fet value above the above listed value (or fisher == 0), and if it has an $fet value below, I would like it to make a new factor (3). When I look at the data frame it is doing something different than this. Any comments/suggestions are much appreciated! (I'm pretty new to coding and am finding factors are not easy to work with!!)