简体   繁体   中英

How to plot theoretical Pareto distribution in R?

I need to plot theoretical Pareto distribution in R.

I want this as a line - not points and not polylines.

My distribution function is 1−(1/x)^2.

I plotted empirical distribution of my sample and also theoretical distribution at one graph:

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

But I got:

在此处输入图像描述

You can see that red line is not continuous, it's something like polyline. Is it possible to get the continuous red line?

Do you have any advices?

Use curve() instead.

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)

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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