Exercise 7.5 error on source

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Exercise 7.5 error on source

Rothrock
First let me say, "Thank you!" for writing this book. It has been my dream for a couple of years to learn Bayesian and your book is fantastic.

I'm using the second edition, JAGS, and R Studio with R version 2.15.2 on a Mac.

On exercise 7.5 I get the following error:

Error in histInfo$density : $ operator is invalid for atomic vectors

This is referring to the value give for densMax that I got

densMax = max( histInfo$density )

I replaced it with the value from BernMetropolisTemplate.R and that worked well.

densMax = max( density( acceptedTraj )$y )
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Exercise 7.5 error on source

John K. Kruschke
Administrator

Thanks for the nice remarks about the book; I'm glad it is useful!

The error you've encountered is caused by a change I made to the output of plotPost(). It used to return aspects of the histogram such as the densities in bins, but now it returns details about the posterior distribution. Therefore histInfo$densities no longer exists. It was only used to set aspects of subsequent graphs such as scale limits, so there are other ways to do things. For example, see the reply to an earlier discussion about this problem, at
http://doing-bayesian-data-analysis.12272.x6.nabble.com/BernMetropolisTemplate-R-td5000491.html#a5000604

Sorry for the hassle! I hope it's not too much of a frustration.

--John




On Fri, Apr 19, 2013 at 1:17 AM, Rothrock [via Doing Bayesian Data Analysis] <[hidden email]> wrote:
First let me say, "Thank you!" for writing this book. It has been my dream for a couple of years to learn Bayesian and your book is fantastic.

I'm using the second edition, JAGS, and R Studio with R version 2.15.2 on a Mac.

On exercise 7.5 I get the following error:

Error in histInfo$density : $ operator is invalid for atomic vectors

This is referring to the value give for densMax that I got

densMax = max( histInfo$density )

I replaced it with the value from BernMetropolisTemplate.R and that worked well.

densMax = max( density( acceptedTraj )$y )



If you reply to this email, your message will be added to the discussion below:
http://doing-bayesian-data-analysis.12272.x6.nabble.com/Exercise-7-5-error-on-source-tp5000641.html
To start a new topic under Doing Bayesian Data Analysis, email [hidden email]
To unsubscribe from Doing Bayesian Data Analysis, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Exercise 7.5 error on source

Rothrock
Thank you. No hassle at all. I figured it was your clever pedagogical trick to get us to look into the guts of plotPost.R.

Yippeee! I can start chapter 8 tonight.
Loading...