# BDA3 Chapter 5 Exercise 5

Here’s my solution to exercise 5, chapter 5, of Gelman’s Bayesian Data Analysis (BDA), 3rd edition. There are solutions to some of the exercises on the book’s webpage.

Suppose the joint distribution for parameters $$\theta = (\theta_1, \dotsc, \theta_J)$$ can be written as a mixture of iid parameters

$p(\theta) = \int \prod_1^J p(\theta_j \mid \phi) p(\phi) d\phi .$

We’d like to show that the pairwise covariance is always non-negative. Since the parameters $$\theta$$ are exchangeable, it is sufficient to show that $$\theta_1, \theta_2$$ have non-negative covariance. Using the law of total covariance, the fact that independent variables have zero covariance, and the fact that exchangeable variables have the same expectation, it follows that

\begin{align} \cov(\theta_1, \theta_2) &= \mathbb E (\cov(\theta_1, \theta_2 \mid \phi)) + \cov(\mathbb E (\theta_1 \mid \phi), \mathbb E(\theta_2 \mid \phi)) \\ &= 0 + \mathbb E \left( \cov \left( \theta_1 \mid \phi, \theta_2 \mid \phi \right) \right) \\ &= \mathbb E \left( \mathbb E(\theta_1 \mid \phi) \mathbb E(\theta_2 \mid \phi) \right) - \mathbb E\left( \mathbb E(\theta_1 \mid \phi) \right) \mathbb E \left( \mathbb E(\theta_2 \mid \phi) \right) \\ &= \mathbb E \left( \mathbb E(\theta_1 \mid \phi)^2 \right) - \left( \mathbb E \mathbb E (\theta_1 \mid \phi) \right)^2 \\ &= \var(\mathbb E(\theta_1 \mid \phi)) \\ & \ge 0 . \end{align}
{"ft_lang_label":"__label__en","ft_lang_prob":0.69306046,"math_prob":0.9997851,"size":1430,"snap":"2021-21-2021-25","text_gpt3_token_len":475,"char_repetition_ratio":0.24123423,"word_repetition_ratio":0.05529954,"special_character_ratio":0.34545454,"punctuation_ratio":0.08163265,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9999777,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-05-14T20:34:01Z\",\"WARC-Record-ID\":\"<urn:uuid:670304cc-9dff-47d1-9125-7ad35bc3786c>\",\"Content-Length\":\"9877\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:435660d4-3092-4162-a97a-4c3c637ecc07>\",\"WARC-Concurrent-To\":\"<urn:uuid:25006987-5698-44ab-b9e9-857514ad042c>\",\"WARC-IP-Address\":\"67.207.81.229\",\"WARC-Target-URI\":\"https://www.briancallander.com/posts/bda3/chapter_05_exercise_05.html\",\"WARC-Payload-Digest\":\"sha1:UORWEEIAQ7MPD7B5XY4A2TEJB6R7HM7T\",\"WARC-Block-Digest\":\"sha1:GQCX3L4PNTHLWXWJSNSEFPCXQ4DMP3CJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-21/CC-MAIN-2021-21_segments_1620243991207.44_warc_CC-MAIN-20210514183414-20210514213414-00171.warc.gz\"}"}