简体   繁体   English

确定经验分布的跳跃

[英]Determine jumps in empirical distribution

Assuming we have a randomly sampled distribution, we can calculate and plot the associated ecdf as follows: 假设我们有一个随机抽样的分布,我们可以如下计算和绘制相关的ecdf:

set.seed(1)
t1 <- rnorm(10000,mean=20)
t1 <- sort(t1)
t1[1:1000] <- t1[1:1000]*(-100)
t1[1001:7499] <- t1[1001:7499]*50
t1[7500:10000] <- t1[7500:10000]*100
cdft1 <- ecdf(t1)
plot(cdft1)

Now in this case, there are jumps (created by intention) in the empirical distribution. 现在,在这种情况下,经验分布中存在跳跃(有意创建)。 By jumps I mean, that it increases by a lot, let's say by more than 100% of the value from before. 我的意思是跳跃,它增加了很多,比以前增加了100%。 This happens in the example at position 7,500. 该示例在位置7,500处发生。 My question is: How can I find these 'jump' indices most effectively? 我的问题是:如何最有效地找到这些“跳跃”指标?

You can get close to what you want just by looking at diff of the sorted t1 values. 通过查看排序的t1值的diff ,您可以接近所需的值。

St1 = sort(t1)
which(diff(St1) > abs(St1[-length(St1)]))
[1] 1000 7499

At point 1000, St1 switches from -1632.8700 to 934.6916, which technically meets your criterion of "more than 100% change". 在点1000,St1从-1632.8700切换到934.6916,从技术上来说,它满足“超过100%变化”的标准。 It does not seem clear to me what is wanted when there is a sign change like this. 在我看来,当出现这样的标志变化时,想要什么是不清楚的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 拟合经验数据的分布 - Fit distribution to empirical data 经验累积分布 function 的 plot (百分比图) - plot of an empirical cumulative distribution function (was Percentile plot) 带有gridExtra的加权经验累积分布图 - Weighted empirical cumulated distribution plot with latticeExtra 叠加经验和/或正态分布的分级直方图 - Binned Histogram with overlay of empirical and/or normal distribution 有效地找到许多任意样本值的经验密度()(如dnorm(),但根据经验分布) - Efficiently find empirical density() for many arbitrary sample values (like dnorm(), but for empirical distribution) 在R中建立经验累积分布函数和数据插值 - Building an empirical cumulative distribution function and data interpolation in R 如何在R中找到多元经验累积分布函数(CDF)? - How to find the multivariate empirical cumulative distribution function (CDF) in R? 提取/导出R(ecdf)中的经验累积分布函数的数据 - Extracting/Exporting the Data of the Empirical Cumulative Distribution Function in R (ecdf) 根据经验分布和copula生成n维随机样本 - Generate n-dim random samples based on empirical distribution and copula 使用 ggplot2 stat_ecdf 在 R 中创建经验分布函数 - Creating empirical distribution function in R using ggplot2 stat_ecdf
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM