R中的基本QQ图

时间:2014-02-11 21:22:15

标签: r

pr1是7种可能结果的概率值 pr_25和pr_75是25%和75%分位数的值。

我想在单个图中绘制具有间数范围的主要分布(pr1),可能具有不同的颜色。 我希望在垂直轴上有概率,在x轴上有7个点值。

这可能是一个很好的解决方案吗?

p11 = (0.9128* 0.3283437)+(1-0.9128)*1/7
p21 = (0.9128* 0.3128438)+(1-0.9128)*1/7
p31 = (0.9128* 0.1723564)+(1-0.9128)*1/7
p41 = (0.9128* 0.1032839)+(1-0.9128)*1/7
p51 = (0.9128* 0.0749610)+(1-0.9128)*1/7
p61 = (0.9128* 0.0079296)+(1-0.9128)*1/7
p71 = (0.9128* 0.0002817)+(1-0.9128)*1/7

p11_25 = (0.9128*2.868e-01)+(1-0.9128)*1/7
p21_25 = (0.9128*2.750e-01)+(1-0.9128)*1/7
p31_25 = (0.9128*1.434e-01)+(1-0.9128)*1/7
p41_25 = (0.9128*8.179e-02)+(1-0.9128)*1/7
p51_25 = (0.9128*5.716e-02)+(1-0.9128)*1/7
p61_25 = (0.9128*1.994e-03)+(1-0.9128)*1/7
p71_25 = (0.9128*2.001e-07)+(1-0.9128)*1/7


p11_75 = (0.9128* 0.3664626)+(1-0.9128)*1/7
p21_75 = (0.9128* 0.3459487)+(1-0.9128)*1/7
p31_75 = (0.9128* 0.1980105)+(1-0.9128)*1/7
p41_75 = (0.9128* 0.1228680)+(1-0.9128)*1/7
p51_75 = (0.9128* 0.0890354)+(1-0.9128)*1/7
p61_75 = (0.9128* 0.0113075)+(1-0.9128)*1/7
p71_75 = (0.9128* 0.0001078)+(1-0.9128)*1/7



r = c(1,2,3,4,5,6,7)
pr25 = c(p11_25,p21_25,p31_25,p41_25,p51_25,p61_25,p71_25)
pr75 = c(p11_75,p21_75,p31_75,p41_75,p51_75,p61_75,p71_75)

1 个答案:

答案 0 :(得分:0)

这似乎不像QQ情节,但它符合你的要求。

首先,让我们清理您的数据创建,使其更像R-like

my_fun <- function(pr, x = 0.98128, n = length(pr)) {
    pr * x + (1 - x) / n
}

pr1 <- c(0.3283437, 0.3128438, 0.1723564, 0.1032839,
         0.0749610, 0.0079296, 0.0002817)
pr1 <- my_fun(pr1)

pr1_25 <- c(2.868e-01, 2.750e-01, 1.434e-01, 8.179e-02,
            5.716e-02, 1.994e-03, 2.001e-07)
pr1_25 <- my_fun(pr1_25)

pr1_75 <- c(0.3664626, 0.3459487, 0.1980105, 0.1228680,
            0.0890354, 0.0113075, 0.0001078)
pr1_75 <- my_fun(pr1_75)

现在制作一个情节。

plot(pr1, ylim = c(0, max(c(pr1, pr1_75, pr1_25))))
points(pr1_75, col= "firebrick4", pch = 3)
points(pr1_25, col = "dodgerblue4", pch = 3)