Hello everyone,
I want to plot horseshoe prior in R with ggplot, can you help me? I have some difficult
Perfect for me is this one:
Hello everyone,
I want to plot horseshoe prior in R with ggplot, can you help me? I have some difficult
Perfect for me is this one:
Do you have some Stan code that you’re working with already? If you can share that it’ll help others provide feedback
No. I’d like to try a replicate this plot
Since this question doesn’t seem to involve Stan, perhaps it would be better suited to Stackoverflow or one of the various R forums?
This answer includes code for plotting various probability density functions with ggplot. The LaplacesDemon
package has the horseshoe density function, dhs
.
The marginal density from the horseshoe model can’t be derived in closed form, which means that the red curve has to be estimated numerically. See for example the discussion in Sparsity Blues.
For visualizing one-dimensional marginal densities quadrature methods can be useful. I ended up using a density estimator on simulations, knitr_case_studies/shrinkage_data.R at 0a987836177477d3fb31e92227854b267aba2f77 · betanalpha/knitr_case_studies · GitHub, which is why the tails look so rough.