The Cauchy Cumulative Distribution Function is:
We use this formula as well as pcauchy function in the plot, and the two lines are plotted with different linewidths.
# ex27.R N <- 500 gamma <- 2 x0 <- 3 x <- seq(-5*gamma+x0,+5*gamma+x0,length.out = N) y <- 1/pi*atan((x-x0)/gamma) + 0.5 main <- sprintf('Cauchy CDF, gamma = %.1f, and x0 = %.1f', gamma, x0) plot(x,y, col = 'black', lwd = 10) lines(x,pcauchy(x,location = x0, scale = gamma), col = 'green', lwd = 5) title(main = main)
No comments:
Post a Comment