1

how to adapt the HDImass of posterior predicted distributions for linear regression in JAGS? I am most content with John Kruschke's R-script Jags-Ymet-Xmet-MRobustPredict.R. I would like to change the default HDImass of 0.95 into 0.9. I applied HPDinterval(mcmcCoda,prob=.9) to generate tables of lower and upper limits, but this code does not change graphs or summaryInfo.

Han Diesfeldt

  • Check https://stats.stackexchange.com/questions/240749/how-to-find-95-credible-interval/240777#240777 for general discussion. The software question is off-topic in here, s you can learn from https://stats.stackexchange.com/help/on-topic – Tim Jul 22 '17 at 17:15

1 Answers1

1

To compute or display the HDI, the scripts call the function HDIofMCMC() which is defined in DBDA2E-utilities.R. An argument of HDIofMCMC is credMass (i.e., the mass of the credibility interval), which defaults to 0.95. You can change it to 0.90 by specifying credMass=0.90. The plotPost() function calls the HDIofMCMC() function, and is designed with the same argument. For example, inside Jags-Ymet-Xmet..., find the relevant calls to plotPost() and include another argument in plotPost, namely, credMass=0.90.

John K. Kruschke
  • 2,153
  • 12
  • 16
  • Hi John, I am using Jags-Ymet-Xnom2grp-MrobustHet. No matter to what value I change credMass in HDIofMCMC = function( sampleVec , credMass=0.95) in DBDA2E-utilities, the summary output remains the same. adding the argument in plotPost works. Any idea? – 00schneider Jul 24 '17 at 15:12
  • plotPost calls HDIofMCMC with an explicit default of 0.95, so you have to set credMass in plotPost – John K. Kruschke Jul 24 '17 at 21:31
  • thanks for the fast reply. I think I have expressed myself unclearly. If I add credMass =.80 in plotPost, it shows the 80% HDI in the plot. It works perfectly fine. But I would like to change the HDI in the summary statistics output (mean, median, mode of posterior etc.) from .95 to .80. I thought this summary statistics output relies on HDIofMCMC. But changing credMass there does not work. – 00schneider Jul 25 '17 at 06:32
  • In Jags-Ymet-Xnom2grp-MrobustHet.R, find every instance of summarizePost() and include the additional argument credMass=0.80 – John K. Kruschke Jul 25 '17 at 17:43
  • That worked, thank you very much. What does the HDIofMCMC() function actually do then? What about the BEST package, when would you recommend its use over the scripts from DBDA2Eprograms? – 00schneider Jul 26 '17 at 07:33