- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一整天都对 R 分位数函数感到困惑。
我对分位数的工作原理有一个直观的概念,并且拥有硕士学位。在统计数据中,但是天哪,它的文档让我感到困惑。
来自文档:
Q[i](p) = (1 - gamma) x[j] + gamma x[j+1],
到目前为止我都同意。对于类型 i 分位数,它是 x[j] 和 x [j+1] 之间的插值,基于一些神秘常数 gamma
where 1 <= i <= 9, (j-m)/n <= p < (j-m+1)/ n, x[j] is the jth order statistic, n is the sample size, and m is a constant determined by the sample quantile type. Here gamma depends on the fractional part of g = np+m-j.
那么,如何计算j呢?米?
For the continuous sample quantile types (4 through 9), the sample quantiles can be obtained by linear interpolation between the kth order statistic and p(k):
p(k) = (k - alpha) / (n - alpha - beta + 1), where α and β are constants determined by the type. Further, m = alpha + p(1 - alpha - beta), and gamma = g.
现在我真的迷失了。 p 以前是一个常数,现在显然是一个函数。
因此,对于类型 7 分位数,默认值...
Type 7
p(k) = (k - 1) / (n - 1). In this case, p(k) = mode[F(x[k])]. This is used by S.
有人愿意帮我吗?特别是,我对 p 作为函数和常量的表示法感到困惑,到底 m 是什么,现在要计算某些特定 p 的 j。
我希望根据这里的答案,我们可以提交一些修订后的文档,以更好地解释这里发生的事情。
quantile.R source code或输入:quantile.default
最佳答案
你很困惑,这是可以理解的。该文档太糟糕了。我必须回到它基于的论文(Hyndman, R.J.;Fan, Y.(1996 年 11 月)。“统计包中的样本分位数”。美国统计学家 50 (4): 361–365 . doi:10.2307/2684934 )以获得理解。让我们从第一个问题开始。
where 1 <= i <= 9, (j-m)/n <= p < (j-m+1)/ n, x[j] is the jth order statistic, n is the sample size, and m is a constant determined by the sample quantile type. Here gamma depends on the fractional part of g = np+m-j.
第一部分直接来自论文,但文档作者省略了 j = int(pn+m)
。这意味着Q[i](p)
仅取决于(排序的)观察中最接近p
分数的两个顺序统计量。 (对于像我这样不熟悉这个术语的人来说,一系列观察的“顺序统计”是排序后的系列。)
另外,最后一句话是错误的。应该是这样的:
Here gamma depends on the fractional part of np+m, g = np+m-j
至于m
,这很简单。 m
取决于选择 9 种算法中的哪一种。因此,就像 Q[i]
是分位数函数一样,m
应该被视为 m[i]
。对于算法 1 和 2,m
为 0,对于算法 3,m
为 -1/2,对于其他算法,将在下一部分中介绍。
For the continuous sample quantile types (4 through 9), the sample quantiles can be obtained by linear interpolation between the kth order statistic and p(k):
p(k) = (k - alpha) / (n - alpha - beta + 1), where α and β are constants determined by the type. Further, m = alpha + p(1 - alpha - beta), and gamma = g.
这确实令人困惑。文档中所说的 p(k)
与之前的 p
不同。 p(k)
是 plotting position 。在论文中,作者将其写为 p
k
,这很有帮助。特别是在 m
的表达式中,p
是原始的 p
,并且 m = alpha + p * (1 -阿尔法 - 贝塔)
。从概念上讲,对于算法 4-9,点 (p
k
, x[k]
) 被插值为得到解决方案(p
、Q[i](p)
)。每种算法仅在 p
k
的算法上有所不同。
至于最后一位,R 只是说明 S 使用的内容。
原始论文给出了 6 个“样本分位数所需的属性”函数的列表,并指出了对 #8 的偏好,它满足所有 1 个。#5 满足所有这些,但他们不喜欢其他的理由(它更多的是现象学而非原理)。 #2 是像我这样的非统计极客会考虑的分位数,也是维基百科中描述的内容。
顺便说一句,回应 dreeves answer , Mathematica 的做法截然不同。我想我理解了映射。虽然 Mathematica 更容易理解,但 (a) 使用无意义的参数更容易搬起石头砸自己的脚,(b) 它无法执行 R 的算法 #2。 (这里是 Mathworld's Quantile page ,它指出 Mathematica 无法执行#2,但根据四个参数给出了所有其他算法的更简单的概括。)
关于math - 解释 R 中的 quantile() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/95007/
这个问题在这里已经有了答案: Converting result of Math.sin(x) into a result for degrees in java (4 个答案) 关闭 5 年前。
我在学习 Kotlin 并在数学课上遇到了这个问题: java.lang.Math 和 kotlin.math 不兼容。这对我来说有点尴尬和困惑,因为 Kotlin 声称它与 Java 100% 兼容
我在其他问题中读到,例如由于浮点表示,sin(2π) 不为零,但非常接近。这个非常小的错误在我的代码中不是问题,因为例如我可以四舍五入 5 位小数。 但是当2π乘以一个非常大的数时,误差就会放大很多。
我正在用 C# 编写一个计算器。 textBoxResult 是我显示数字的文本框 recount 是一个以度为单位的角度并以弧度为单位返回的函数 我从 texBoxInput 获取角度 public
首先,让我们从我的数学背景开始。我已经学习了微积分 I - IV 和微分方程。我参加了第一学期的计算机图形类(class),在该类(class)中我们实现了几乎我们自己的图形管道,包括使用 Phong
早上好! 我只是想磨练我的数学能力,我特别有一些关于 Cocos2D 的问题。由于 Cocos2D 想要“简化”事物,所有 Sprite 都有一个旋转属性,范围从 0-360(359?)CW。这迫使你
是否有人对Intel Math Kernel Library和AMD Math Core Library都有编程经验?我正在建立一台用于高性能统计计算的个人计算机,并对正在购买的组件进行辩论。 AMD
函数的反函数是什么 math.atan2 我在 Lua 中使用它,我可以通过 math.tan 获得 math.atan 的逆。 但我在这里迷路了。 编辑 好的,让我向您提供更多详细信息。 我需要计算
我有一道等轴测投影的数学题。我读了一篇文章:Axonometric projections - a technical overview .对于等距投影部分,它给出了将 x 部分的 3D 点转换为 2
在 MySQL (5.1) 数据库表中,有数据表示: 用户执行任务需要多长时间 用户在任务中处理了多少项目。 MySQL 是否支持关联数据,还是我需要使用 PHP/C# 来计算? 我在哪里可以找到计算
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 9 年前。 Improv
我正在尝试使用这两种方法在 C# 中解决这个问题: public double NormalPowerMethod(double x, double toPower) { return Mat
如何分配: var randomNumber = Math.random()*50 + Math.random()*20; 比较: var randomNumber = Math.random()*7
我正在查看我的代码,希望提高它的性能,然后我看到了这个: int sqrt = (int) Math.floor(Math.sqrt(n)); 哦,好的,我真的不需要调用 Math.floor,因为转
尝试调用 math.h 中的函数时, 我收到如下链接错误 undefined reference to sqrt 但我正在做一个 #include 我正在使用 gcc 并编译如下: gcc -Wall
祝大家有个愉快的一天,我有话要问你,为了更好地理解这里是我的代码: {math equation=((($order_total-$commission)+$discount+$delivery_ch
我尝试学习一些Clojure,因为该语言看起来不错。 但是似乎没有关于如何安装/使用库的信息,例如clojure.math.numeric-tower。 现在,我通过在Linux shell中键入以下
As Math.sign() 接受数字参数或数字作为字符串,如 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Gl
如何将scala.math.BigDecimal转换为java.math.BigDecimal? 最佳答案 无需在字符串之间进行双重转换。 val sb = scala.math.BigDecimal
为什么下面的 JavaScript 会这样 Math instanceof Math 抛出错误 TypeError: Expecting a function in instanceof check,
我是一名优秀的程序员,十分优秀!