我經常使用核心密度圖來說明分佈。這些都是很容易和快速R中創造像這樣:在兩點之間着色一個內核密度圖。
set.seed(1)
draws <- rnorm(100)^2
dens <- density(draws)
plot(dens)
#or in one line like this: plot(density(rnorm(100)^2))
這給了我這個可愛的小PDF:
我想樹蔭從第75的PDF下面積到第95百分位。這很容易使用quantile
函數來計算得分:
q75 <- quantile(draws, .75)
q95 <- quantile(draws, .95)
但我怎麼遮蔭q75
和q95
之間的區域?
你能提供例如遮着範圍外對你的範圍內嗎?謝謝。 – Milktrader 2011-03-25 14:34:03