【问题标题】:How to plot theoretical Pareto distribution in R?如何在 R 中绘制理论帕累托分布?
【发布时间】:2020-11-12 01:04:04
【问题描述】:

我需要在 R 中绘制理论帕累托分布。

我希望这是一条线——不是点也不是折线。

我的分布函数是 1−(1/x)^2。

我在一张图上绘制了样本的经验分布和理论分布:

ecdf(b2)
plot(ecdf(b2))
lines(x, (1-(1/x)^2), col = "red", lwd = 2, xlab = "", ylab = "")

但我得到了:

你可以看到红线不是连续的,它有点像折线。有没有可能得到连续的红线?

你有什么建议吗?

【问题讨论】:

    标签: r math plot distribution


    【解决方案1】:

    请改用curve()

    library(EnvStats)
    set.seed(8675309)
    # You did not supply the contents of b2 so I generated some
    b2 <- rpareto(100, 1, 2)
    plot(ecdf(b2))
    ppareto <- function(x) 1−(1/x)^2
    curve(ppareto, col = "red", add = TRUE)
    

    【讨论】:

      猜你喜欢
      • 2021-06-26
      • 1970-01-01
      • 1970-01-01
      • 2021-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多