# Plotting CDFs of transformed normal random variables

I'm using the following transformed random variables

hX = TransformedDistribution[(z + 1/3)^2,
z \[Distributed] NormalDistribution[0, 1]]
hY = TransformedDistribution[(z + 1/3)^2,
z \[Distributed] NormalDistribution[1, 2]]


First I tried to plot the PDF of hY by running

Plot[PDF[hY, x], {x,0,1}]


But the plotting fails as some branches of the PDF are not well-defined (even though in the interval (0,1) everything is of course okey). I found a work around on this with Refine[..., x>0] but I would like to know what causes Mathematica to not be able to plot it without it? Any other ways to do it?

Next I wanted to plot the composition function

1 - Refine[CDF[hY, InverseCDF[hX, 1 - x]], InverseCDF[hX, 1 - x] > 0]


But when I run the code

Plot[1 - Refine[CDF[hY, InverseCDF[hX, 1 - x]],
InverseCDF[hX, 1 - x] > 0], {x, 0, 1}, ImageSize -> 600]


It is quite slow (something between 30-60 seconds). Any way to make this faster? I know that it is not that slow but if the distributions were even more complex I bet it would slow down even more. Any way to make it faster? Maybe there are some commands that I don't know of make it faster? Or maybe there is some much faster approximate method.

• tried Plot[Evaluate@PDF[hY, x], {x, 0, 1}]? – kglr Apr 10 at 8:39
• @kglr Great. That solves the first problem but not the second. – Harto Saarinen Apr 10 at 13:27