- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在搜索 John Tukey 算法,该算法使用 R 在我的线性回归上计算“阻力线”或“中值-中值线”。
邮件列表上的一位学生用这些术语解释了这个算法:
"The way it's calculated is to divide the data into three groups, find the x-median and y-median values (called the summary point) for each group, and then use those three summary points to determine the line. The outer two summary points determine the slope, and an average of all of them determines the intercept."
关于 John tukey 好奇中位数的文章:http://www.johndcook.com/blog/2009/06/23/tukey-median-ninther/
你知道我在哪里可以找到这个算法或 R 函数吗?在哪些包中,非常感谢!
最佳答案
里面有关于如何计算中线here的说明.一个 R 实现是
median_median_line <- function(x, y, data)
{
if(!missing(data))
{
x <- eval(substitute(x), data)
y <- eval(substitute(y), data)
}
stopifnot(length(x) == length(y))
#Step 1
one_third_length <- floor(length(x) / 3)
groups <- rep(1:3, times = switch((length(x) %% 3) + 1,
one_third_length,
c(one_third_length, one_third_length + 1, one_third_length),
c(one_third_length + 1, one_third_length, one_third_length + 1)
))
#Step 2
x <- sort(x)
y <- sort(y)
#Step 3
median_x <- tapply(x, groups, median)
median_y <- tapply(y, groups, median)
#Step 4
slope <- (median_y[3] - median_y[1]) / (median_x[3] - median_x[1])
intercept <- median_y[1] - slope * median_x[1]
#Step 5
middle_prediction <- intercept + slope * median_x[2]
intercept <- intercept + (median_y[2] - middle_prediction) / 3
c(intercept = unname(intercept), slope = unname(slope))
}
为了测试它,这里有一个例子:
dfr <- data.frame(
time = c(.16, .24, .25, .30, .30, .32, .36, .36, .50, .50, .57, .61, .61, .68, .72, .72, .83, .88, .89),
distance = c(12.1, 29.8, 32.7, 42.8, 44.2, 55.8, 63.5, 65.1, 124.6, 129.7, 150.2, 182.2, 189.4, 220.4, 250.4, 261.0, 334.5, 375.5, 399.1))
median_median_line(time, distance, dfr)
#intercept slope
# -113.6 520.0
请注意指定组的方式有点奇怪。这些说明对于如何定义组大小非常挑剔,因此更明显的方法 cut(x, quantile(x, seq.int(0, 1, 1/3)))
没有工作。
关于algorithm - John Tukey "median median"(或 "resistant line")R 和线性回归的统计检验,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3224731/
我整个星期都在用一个具有挑战性的设计来解决它,我正在完成我的最后一件抵抗运动,今天还剩一个小时, 我这里有一个菱形/蜂窝状的用户界面 http://jsfiddle.net/z42wg/25/ .di
当我添加一段代码来测量 CPU 执行时间时,例如: int main() { clock_t init_time = clock(); // (1) your_fun(); // (2)
我正在寻找最合适的类作为从我的 Activity 调用的 AsyncTasks 的调度程序。 我认为它可能是其中之一: 应用程序的子类; 服务的子类; 我自己的静态 东西。 至于我 - 实现第三个选择
我正在尝试将 4 线电阻式触摸屏连接到 Microchip 的 PIC24FJ256。这是我第一次使用这些,我正在寻找如何操作的指导。 我能找到的只是 Microchip 的一个名为“ResTouch
我需要在 JavaScript 中实现鼠标抵抗。 作为我的意思的一个例子,想一想 Enlightenment 窗口管理器如何处理屏幕边缘阻力以在不同桌面之间切换,或者如果您不熟悉它: 想象一个大矩形,
When i launch app then below error print in debug log, i want to find out is it app side issue or de
例子如下: http://jsbin.com/nulocufoka/1/ input 控件的单元格由于某种原因“跳出”。 item 1 piece
我在有关 Cocoa Autolayout 的 Apple 文档中找不到有关内容拥抱和压缩阻力之间差异的明确答案。 有人可以解释一下它们的用法和区别吗? 最佳答案 概念快速总结: 拥抱 => 内容不想
我需要画两条水平线来表示支撑和阻力。 这是我的代码: from alpha_vantage.timeseries import TimeSeries import mplfinance as mpf
我正在搜索 John Tukey 算法,该算法使用 R 在我的线性回归上计算“阻力线”或“中值-中值线”。 邮件列表上的一位学生用这些术语解释了这个算法: "The way it's calculat
我在固定高度的单元格中有 2 个 UILabels。这两个标签都是多行的,我需要垂直压缩两个标签,以防文本不适合单元格。我在第一个标签上设置了稍高的优先级,因为那里的文本更重要,而且我定义了垂直空间限
我正在尝试调试自动布局问题,了解 Content Hugging 和 Content Compression Resistance 优先级的默认值会有所帮助。 它们是什么?它们是否特定于特定组件?我可
我已经使用像这样的自动布局实现了自定义单元格: 如您所见,它有 4 个部分:[thumbnail, title, summary, feedName]。 我需要精美地布置title 和summary。
我是一名优秀的程序员,十分优秀!