Patrick Wang wrote: > > assume I need to generate X from inverse gamma with parameter (k, > beta). > > should I generate from Y from gamma(-k, beta), > > then take X=1/Y? > Check the Borg of All Wisdom... http://en.wikipedia.org/wiki/Inverse-gamma_distribution
Generate Y from gamma(k, 1/beta) (using... rgamma(n = number.of.points, shape = k, scale = 1/beta) ... or ... rgamma(n = number.of.points, shape = k, rate = beta) ) and take X = 1/Y (unless your beta is not the rate parameter...) Alberto Monteiro ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
