G'day Chris, On Fri, 28 May 2010 08:29:30 -0500 Christopher David Desjardins <cddesjard...@gmail.com> wrote:
> Hi, > I am trying to recreate the right graph on page 524 of Gelman's 2006 > paper "Prior distributions for variance parameters in hierarchical > models" in Bayesian Analysis, 3, 515-533. I am only interested, > however, in recreating the portion of the graph for the overlain > prior density for the half-Cauchy with scale 25 and not the posterior > distribution. However, when I try: > > curve(dcauchy, from=0, to=200, location=0, scale=25) Which version of R do you use? This command creates 12 warnings under R 2.11.0 on my linux machine. Reading up on the help page of curve() would make you realise that you cannot pass the location and scale parameter to dcauchy in the manner you try. I guess you want: R> prior <- function(x) 2*dcauchy(x,location=0, scale=25) R> curve(prior, from=0, to=200) or, more compactly, R> curve(2*dcauchy(x, location=0, scale=25), from=0, to=200) Cheers, Berwin ========================== Full address ============================ Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Maths and Stats (M019) +61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009 e-mail: ber...@maths.uwa.edu.au Australia http://www.maths.uwa.edu.au/~berwin ______________________________________________ R-help@r-project.org 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.