# What is the correct to model inverse gamma distribution [closed]

I tried to use below R code to model inverse gamma distribution (alpha=1,beta=1). However, the resulting histogram is not alike the one plotted in the wiki. Could anyone provide any hint about this? Thank for you help.

v <- rgamma(1,1,100000) v <- 1 / v dv <- as.data.frame(v) ggplot(data=dv,aes(x=v)) + geom_histogram()

## closed as off-topic by whuber♦Jan 15 '17 at 19:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – whuber
If this question can be reworded to fit the rules in the help center, please edit the question.

The line v <- rgamma(1,1,100000) draws one observation from a $\text{Gamma}(1,100000)$. You can't make a histogram of this, since you only have one point. Since you say you want to draw from an $\text{InvGamma}(1,1)$, you probably want
v <- rgamma(n=1000,shape=1,rate=1)