Cauchy distribution is a type of continuous probability distribution which is also known as Lorentz distribution. It resembles normal distribution curve but has a taller peak with tails decaying much more slowly than normal distribution.
It is mainly used as an example of a "pathological" distribution due to an undefined variance.
In this recipe, we will learn how to plot cauchy distribution.
We will use sequence (seq()) function to do the same.
# creating numbers to plot between -5 and 5 with a difference of 0.01 between each of them x_cauchy = seq(-5, 5, by = 0.01)
We use dcauchy() and plot() function to carry out the task
plot(x_cauchy, # x-values dcauchy(x_cauchy), # y-values type = "l", # lineplot col = "red", #colour of the line lwd = 2, # line width xlab = "X-values", # x-label ylab = "Probability density", # y-label main = "Cauchy Distribution") # title