Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个观察向量,想用 R 获得每个观察的经验 p 值。我不知道基本分布,我目前所做的只是
runif(100,0,1000)->ay quantile(ay)
但是,这并没有真正给我一个 p 值。如何凭经验获得 p 值?
我认为你想要的是ecdf功能。这将返回一个经验累积分布函数,您可以直接应用
ecdf
ay <- runif(100) aycdf <- ecdf(ay)
接着
> aycdf(c(.1, .5, .7)) [1] 0.09 0.51 0.73
我想这就是你要找的:
rank(ay)/length(ay)