Dear BugsList,
I would appreciate your comments on the 'truncated distribution problem” that has been raised in previous submissions to the BugsList.
Last year Don van Ravenzwaaij, Ruud Wetzels, and Eric-Jan Wagenmakers submitted an enquiry to the BugsList concerning the use of the dist()I(lower, upper) construction in WinBUGS as a method for dealing with truncated distributions, as opposed to its intended purpose, namely dealing with censored observations. Their BugsList submission was prompted by the paper by David Lunn et al (Lunn, D., Spiegelhalter, D., Thomas, A., and Best, N. (2009). The BUGS project: Evolution, critique and future directions. Statistics in Medicine) in which is is stated that the I(lower, upper) construction can be used for modelling truncated distributions, provided they have no unknown parameters.
David Lunn responded to the BusgList enquiry with a detailed discussion of the distinction between models involving truncated distributions and problems involving censored observations. This was followed by a second submission from Don van Ravenzwaaij showing some results he obtained in an assessment of the improper use of the I(,) construction.
In his BugsList contribution David Lunn reiterates the fact that the distr()I() construction can be used for truncation only if the parameters of the distribution are known. As I understand it, this is because the denominator required to ensure integration to unity is constant given fixed parameter values. My question relates to hierarchical models involving truncated distributions specified in terms of hyperparameters. I have not found a straightforward and general way for dealing with this problem.
Simon Jackman provides useful information on his website, which includes code for a truncated distribution in which the constraint is obtained using dunif().I found his code very instructive. But I have an exchangeable random effects modelling problem involving spherical coordinates and so-called volume fractions, each of which must be constrained to an interval. Thus the model uses various distributions, involving hyperparameters, and these must be truncated.
I have adopted an approach using a transform to map the required intervals to the real line, combined with using the zeros trick to incorporate a change-of-variables weighting.
The details are as follows. I would appreciate any comments on the validity of this approach and/or better methods for dealing with the problem. (While preparing this enquiry, I discovered that David Lunn has provided a WBDev function for dealing with the truncated normal case).
I used the transformation
temp = exp(parm)/(1 + exp(parm))
parm.prime = lower + (upper – lower)*temp.
The required change-of-variables weighting is
(upper – lower)exp(parm)/(1 + exp(parm))**2
This makes sense because the transformation results in an excess of density at the extremes of the truncated distribution, while the change-of-variables weight goes to zero at each end of the interval.
The change of variables weighting is achieved using the zeros trick, as follows:
exp.term <- exp(parm.prime)
changeVar <- (upper - lower) * exp.term/(pow((1 + exp.term),2))
zerotrick <- -log(changeVar)
zero ~ dpois(zerotrick)
zero <- 0
I have given a direct/explicit coding of the various functions for clarity, recognising that this can be coded rather more efficiently.
I would appreciate any comments on this approach as a general method for coding truncated distbutions in WinBUGS, together with better/alternative procedures.
With many thanks,
Martin King
*******************
Biophysics, Radiology & Physics Unit
Institute of Child Health/Gt Ormond Street Hospital for Children
30 Guilford Street
London WC1N 1EH, UK
tel: + 44 (0)20 7905 2125
fax: + 44 (0)20 7905 2358
email: [log in to unmask]
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|