Exercise 2.2 [OLD] | ||||||||||
 [TA] Di Su   Created at: 0000-00-00 00:00   2022A2Ex2 | 0 | |||||||||
Exercise 2.2 (${\color{red}\star}{\color{red}\star}{\color{gray}\star}$ - Posterior of function of parameters (50%)). Consider the problem in Exercise 2.1. In this exercise, assume the following prior for \((\pi_0, \pi_1)\): \[f(\pi_0, \pi_1) = \mathbb{1}(\pi_0,\pi_1\in(0,1)).\]
To plot the PDF, you may use of the following methods.
| ||||||||||
4 | ||||||||||
Easy Difficult Number of votes: 7 | ||||||||||
Ex 2.2 | |
Anonymous Kraken   Created at: 2022-02-09 02:51 | 0 |
For 4., I'm not sure how to show that the posterior is proper. Do we have to show that the integral of the posterior pdf over the support is finite or show that the posterior consists of several random variables of known distributions? | |
Show 1 reply | |
 [TA] Di Su   Last Modified: 2022-02-10 13:12 | 6 |
Both methods are possible.
To show that the pdf of a random variable $\theta$ is proper, we need to show it satisfies the definition of a probability density function by showing $$\int_{\Theta}f(\theta)\mathrm{d}\theta=1.$$ We can express the density in terms of its kernel as $f(\theta)=C\kappa(\theta)$. Then we need to show $$\int_{\Theta}C\kappa(\theta)\mathrm{d}\theta=1\implies\int_{\Theta}\kappa(\theta)\mathrm{d}\theta=\frac{1}{C}.$$ We require $C\neq0$ so that the density is non-degenerate. Then $1/C<\infty$ and we only need to show $$\int_{\Theta}\kappa(\theta)\mathrm{d}\theta<\infty,$$ because $C$ is explicitly determined by $C=1/\int_{\Theta}\kappa(\theta)\mathrm{d}\theta$.
If the posterior of a parameter $\theta$ can be expressed in terms of known distributions, then it is proper by construction. | |
Question about part (2) | |
Anonymous Giraffe   Created at: 2022-02-09 16:54 | 1 |
Hello, in part (2), I am trying to derive the sampling distribution f(x|theta), in order to find the posterior distribution. However, I am not sure how I can represent the two independent Bernoulli distributions using one single parameter theta. Could I have some hints on this? Thanks. | |
Show 3 reply | |
 [TA] Di Su   Last Modified: 2022-02-09 23:58 | 5 |
Notice that the group labels $\{(j)\}$ are given and fixed. To express the joint distribution of two groups of data using only one parameter, there are two steps. Firstly, since the two groups are independent of each other, we can factorize their joint distribution as $$f(x^{(group \;1)},x^{group\;2})=f(x^{(group\;1)})f(x^{(group\;2)}).$$ Secondly, the data points within each group are IID, so we can further factorize the joint distribution of each group as $$f(x^{(group\;j)})=\prod_{i=1}^nf(x^{(group\;j)}_i),j=1,2.$$ The key is independence. | |
Anonymous Giraffe   Created at: 2022-02-09 21:51 | 1 |
Thanks for the reply. I still have a question in mind. I understand $f(x|\pi_0, \pi_1)$ is either in terms of $\pi_0$ or $\pi_1$. However, when it comes to $f(x|\theta)$, $\theta$ is defined as $(\pi_0-\pi_1)/\pi_1$, and I am not sure how to incorporate $\theta$ into $f(x|\theta)$. Thanks. | |
 [Instructor] Kin Wai (Keith) Chan   Created at: 2022-02-09 22:14 | 6 |
It is exactly the learning moment of this question. To answer the question, you may proceed in two steps:
| |
Independence | |
Anonymous Orangutan   Last Modified: 2022-02-10 13:06 | 0 |
Because of the independence, is it possible to rewrite like this ? \[f(\pi0,\pi1) = 1(\pi0,\pi1\in(0,1)) = 1(\pi0 \in(0,1)) ×1(\pi1\in(0,1)) = unif(0,1) ×unif(0,1)\] | |
Show 1 reply | |
 [TA] Di Su   Last Modified: 2022-02-10 13:12 | 3 |
Yes, it can be factorized as $f(\pi_0,\pi_1) = 1(\pi_0 \in(0,1)) ×1(\pi_1\in(0,1))$, and in this way we know $\pi_0\sim Unif(0,1),\pi_1\sim Unif(0,1)$ where $\pi_0$ is independent of $\pi_1$. However, $f(\pi_0,\pi_1)$ is a probability density function, whereas $Unif(0,1) ×Unif(0,1)$ represents a distribution, and it is not rigorous to write $f(\pi_0,\pi_1)=Unif(0,1)\times Unif(0,1)$. | |
prior distribution | |
Anonymous Orangutan   Last Modified: 2022-02-11 18:09 | 0 |
When I computed θ by using given prior, there is a probability that θ will be a huge value like (349) . And it affects the mean value of θ and the form of distribution. As a result, distribution become strange shape and axis. | |
Show 1 reply | |
 [Instructor] Kin Wai (Keith) Chan   Last Modified: 2022-02-11 18:06 | 5 |
Probably, you faced a problem when you plot the prior density. It is a very goodquestion. Indeed, it is the challengingpart of the question. Plotting the density of the prior is a bit tricky. As I mentioned in the hints, there are two methods.
| |
Prior distribution (Q5 solution) | |
Anonymous Orangutan   Last Modified: 2022-02-17 14:25 | 0 |
I derived my prior distribution by using representation. However, in the solution, prior pdf is derived by this step.It can be derived by finding the joint density of (θ, π1) using the Jacobian method, and then integrate out π1. The true prior density is directly plotted I'm confused 2 points.
| |
Show 2 reply | |
 [TA] Di Su   Last Modified: 2022-02-18 10:12 | 2 |
Thanks for your question!
The prior density is $$\begin{align}f\left(\theta\right)=\left\{\begin{array}{cc}\frac{1}{2} & -1<\theta<0 \\\frac{1}{2 (\theta+1)^{2}} & \theta\geq0 \end{array}.\right.\end{align}$$ It can be derived by the following steps. Firstly, let $$y_1=\pi_0/\pi_1-1,y_2=\pi_1.$$ Correspondingly, $$\pi_0=(y_1+1)y_2,\pi_1=y_2.$$ Because of the constraint $\pi_0,\pi_1\in(0,1)$, it must be satisfied that $(y_1+1)y_2\in(0,1),y_2\in(0,1)$. Moreover, it is easily seen that $y_1=\pi_0/\pi_1-1\in(-1,\infty)$. Therefore, we must have $$y_1\in(-1,\infty),y_2\in(0,\min(1,1/(y_1+1))).$$ Secondly, the Jacobian matrix of the mapping from $(y_1,y_2)$ to $(\pi_0,\pi_1)$ is Thus we have Thirdly, denoting the support of $y_2$ as $\mathcal{Y}_2$, the marginal distribution of $y_1$ can then be found by Since $\theta\equiv y_1$, the desired density follows. The solution is also updated.
Repetition of $0$ is for better visualization. We know $f(\theta)=0 $ on the interval $[-2,-1]$. And $101$ is the repetition number. The repetition number comes from how we set the x-axis. Notice the interval $(-1,0)$ is divided into 100 sub-intervals with length $0.01$. However, there are $101$ boundary points. Hence there is an extra $1$. | |
Anonymous Orangutan   Created at: 2022-02-17 17:41 | 0 |
Thanks for your reply. However, there are some latex errors. I hope you will fix this. Thanks | |
Using Representation in Ex.2.2 Q1 | |
Anonymous Grizzly   Created at: 2022-02-18 12:43 | 0 |
In Exercise 2.2 Q1, I represent $(\pi_0,\pi_1)=B_0+B_1$, where $B_0\sim\text{Beta}(S_0+1,m-S_0+1)$ and $B_1\sim\text{Beta}(S_1+1,n-S_1+1)$ because after Jacobian transformation, I can get $$f\left(\pi_0,\pi_1\mid x_{1:m}^{(0)},x_{1:n}^{(1)}\right)\propto\pi_0^{S_0}(1-\pi_0)^{m-S_0}\pi_1^{S_1}(1-\pi_1)^{n-S_1}\mathbb{1}\left\{\pi_0,\pi_1\in(0,1)\right\}$$ which seems reasonable. However, it turns out that my answer is wrong. What is the reason? Thank you. | |
Show 1 reply | |
 [TA] Di Su   Created at: 2022-02-18 13:15 | 2 |
There are two problems regarding your answer:
| |