Skip to content

Instantly share code, notes, and snippets.

@aburkard
Last active April 28, 2018 06:15
Show Gist options
  • Save aburkard/b0f26d3995d22916cbeedb4043d34872 to your computer and use it in GitHub Desktop.
Save aburkard/b0f26d3995d22916cbeedb4043d34872 to your computer and use it in GitHub Desktop.
Sampling Inverse-Chi-squared distribution in R
v <- 7
scale <- 5
set.seed(5)
plot(density(rinvgamma(100000, shape=v/2, scale=v/2*scale)))
set.seed(5)
plot(density(v*scale/rchisq(100000, df=v)))
require(geoR)
set.seed(5)
plot(density(rinvchisq(100000, df=v, scale=scale)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment