Timeline for Difference between charts of rcauchy(10000) and geom_function(fun = dcauchy)
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 28, 2023 at 16:11 | answer | added | Cong Chen | timeline score: 3 | |
Apr 28, 2023 at 10:04 | comment | added | Henry |
Your red curve should have a peak at 1/pi $\approx 0.32$ while your black curve should have a peak at 1/pi/(pcauchy(10)-pcauchy(-10)) $\approx 0.34$ and that seems to be what you see
|
|
Apr 28, 2023 at 7:57 | history | became hot network question | |||
Apr 28, 2023 at 7:57 | comment | added | COOLSerdash |
See what happens if you replace geom_function(fun = dcauchy, colour = 'red') with geom_function(fun = (\(x)(1/(2*atan(10) + 2*x^2*atan(10)))), colour = 'red') . The second function is the density of a truncated Cauchy distribution at $-10$ and $+10$.
|
|
Apr 27, 2023 at 21:08 | comment | added | Lukas Lohse |
@Sigma xlim in ggplot deletes observation outside of it's range. You could use coord_cartesian(xlim = c(-10, 10)) but geom_density doesn't cope well with extreme range you get from 10^7 Cauchy values
|
|
Apr 27, 2023 at 19:46 | answer | added | Jarle Tufto | timeline score: 17 | |
Apr 27, 2023 at 19:16 | comment | added | Sigma |
Filter simply removes extreme data. In the particular case of the cauchy distribution, if you run rcauchy(10000) you get values such as -4000 which completely distort the graph. Another option is to use xlim(-5, 5) but the same thing happens. The cauchy doesn't have a closed form for SD so you cannot really compare the two.
|
|
Apr 27, 2023 at 19:10 | comment | added | whuber♦ |
Hint: Please explain in more detail what you believe filter does here. Another hint: do the same thing with, say, a Normal distribution, but filter out all values more extreme than one SD from the mean.
|
|
Apr 27, 2023 at 19:09 | history | asked | Sigma | CC BY-SA 4.0 |