繁体   English   中英

如何将plot理论帕累托分布在R?

[英]How to plot theoretical Pareto distribution in R?

我需要 R 中的 plot 理论帕累托分布。

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

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

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

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

但我得到了:

在此处输入图像描述

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

你有什么建议吗?

请改用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)

在此处输入图像描述

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM