Plot the change of variable for a Gaussian distribution?

I am going through the Pattern Matching and Machine Learning book by Bishop and have gotten stuck on a few things in Mathematica. In the solution for exercise 1.4 (page 7/101) there is a graph showing a probability distribution transformed by a function.

Here are the questions that I have regarding this:

  • How do I plot the green and the magenta curves on the y axis?
  • Why are the green and the magenta curves near each other in size in the book, but not in my own plots?
  • Why can’t I integrate the transformed curves so as to get the CDF?
  • How do I get the mode of the transformed curves?

Here is the code for what I’ve done so far. I am been trying out various things to no avail.

dist = PDF[NormalDistribution[6, 1]]

g[y_] := Log[y] - Log[1.0 - y] + 5.0

Plot[{dist\[x\], dist[g\[x\]\]*Abs[g'\[x\]\], dist[g\[x\]\]}, {x, 0, 10}, 
 PlotRange -> Full, PlotLegends -> "Expressions"]

I don’t have a good idea for plotting that second function on the y axis, but Mathematica has a built-in function for doing these sort of variable transformations on distributions: TransformedDistribution. In the example in the book, y is distributed as LogisticSigmoid[x - 5] where x follows a normal distribution. You can define this as:

dist = TransformedDistribution[
    LogisticSigmoid[x - 5],
    x \[Distributed] NormalDistribution[6, 1]
]

You can plot its PDF:

Plot[Evaluate[PDF[dist, y]], {y, 0, 1}]

and you can draw samples from it:

RandomVariate[dist, 10]

Find the mode of the distribution:

Maximize[PDF[dist, y], y]
N[%]

Could inputs to the distribution be transformed as well?

That is what TransformedDistribution does. It transforms x, which is the input variable to the PDF of NormalDistribution[6, 1].

Yes, this always confuses me as well whenever I haven’t worked with probability distributions for a while :).