2

Given is the density $$f(x)=\begin{cases} \frac{3}{4}\left(2x-x^2\right)&\mbox{if }x \in (0,2) \\ 0&\mbox{else}\end{cases}$$

Find a random variable for the density.

There are probably several methods for doing this but I only know of inverse transform and I like to try to use it here.

Firstly, we need the distribution function of the density. It is (just assume this is correct):

$$F(x)=\begin{cases} \frac{3}{4}x^2-\frac{1}{4}x^3&\mbox{if }0<x\leq 2 \\ 1 &\mbox{if }x>2\\ 0 &\mbox{if }x<0\end{cases}$$

Now we need to inverse this distribution function: $$y=\frac{3}{4}x^2-\frac{1}{4}x^3$$

I used a software for this one because it got very complicated when I tried to do it by hand :(

$$x= \sqrt[3]{2\sqrt{y^2-y}-2y+1}+\frac{1}{\sqrt[3]{2\sqrt{y^2-y}-2y+1}}$$

While the other party of the distribution function didn't need any change except for the cases, so for the inverse we have

$$F^{-1}(y)=\begin{cases} \sqrt[3]{2\sqrt{y^2-y}-2y+1}+\frac{1}{\sqrt[3]{2\sqrt{y^2-y}-2y+1}}&\mbox{if }\\ 1 &\mbox{if }\\ 0 &\mbox{if }\end{cases}$$

I didn't expect it will end up that complicated, I don't even know what cases I need to use and how the inverse of $0$ will be treated as it doesn't seem to be defined : /

Maybe there is an easier way of solving the problem or did I miss an important step / did a mistake somewhere? :s

cnmesr
  • 4,910
  • 2
    What do you mean by "Find a random variable for the density."? – Mostafa Ayaz Jan 28 '18 at 19:23
  • I think that show who is $F$ is sufficient, because $F$ is a probability distribution, so $X$ is a r.v. such that $\mathbb{P}(X \le x)=F(x)$ – Skills Jan 28 '18 at 19:28
  • @MostafaAyaz By that I mean "Simulate a random variable by the given density". I thought I could do it with inversion method. But as I tried above, it didn't go well : / – cnmesr Jan 28 '18 at 19:37
  • @Skills Is that really it? :o No further calculations needed? – cnmesr Jan 28 '18 at 19:40
  • 1
    You really don't need the "cases". The cdf has range $[0,1]$, so $[0,1]$ is the domain of the inverse and you needn't consider inputs outside that interval. Intuitively, you are going to "simulate" $X$ by generating a random number $U$ uniformly in $[0,1]$ and plugging into $F^{-1}$. – Nate Eldredge Jan 28 '18 at 20:12
  • 1
    @NateEldredge How do I write all that correctly in maths? Ok, I'm plugging $U$ into my inverse as you recommended: $$X=F^{-1}(U)$$ Then $$F_X(x)=P(X\leq x) = P(F^{-1}(U) \leq x)=P(U \leq F(x))=F(x)$$ ? – cnmesr Jan 28 '18 at 20:22
  • 1
    Right, that's exactly the idea. – Nate Eldredge Jan 28 '18 at 20:23
  • @NateEldredge Great thanks :) Maybe you can show how the inverse needs to look like? I'm not sure if mine is really right because of these cases. I don't know how they need to look like now :o – cnmesr Jan 28 '18 at 20:25
  • 1
    What I'm saying is that there are no cases. You could just say $F^{-1}(y) = \sqrt[3]{\dots} + \dots$ with the formula you have, assuming the algebra is right. There's a separate issue that the quantity under the cube root is a complex number (note $y^2 - y < 0$) and it has three cube roots. If the algebra is right then one of them should be a real number, and that's the value you really want $F^{-1}$ to have. – Nate Eldredge Jan 28 '18 at 20:42
  • 1
    I don't know what methods of generating distributions you have studied. The inverse CDF (quantile) approach seems a little messy. // That is (by far) not the only method. Seems a good candidate for an 'acceptance-rejection' method. // Have you noticed the relationship btw your dist'n and BETA(2,2)? – BruceET Jan 29 '18 at 00:56
  • 2
    Perhaps look at this. – BruceET Jan 29 '18 at 01:07

0 Answers0