Here's a tutorial on how to debug such things
The first thing you must try when this happens is you should put a number in place of y
and see what the expression evaluates to:
bivTCond[1, 1, 3, 0.5]
(*
==> {(
8 Pi PDF[
MultivariateTDistribution[{{1, rho}, {rho, 1}}, nu], {1, 1, 3,
0.5}])/(3 Sqrt[3]),
8 Sqrt[3] Pi PDF[
MultivariateTDistribution[{{1, rho}, {rho, 1}}, nu], {1, 1, 3,
0.5}]}
*)
You can see that there are still free variables present (rho
and nu
). This is not a numerical quantity, so obviously it can't be used in a plot.
To understand why rho
and nu
were not properly substituted by numbers, read about :=
vs =
. The first fix needed is using =
instead of :=
in the definition of bivTCond
. The Evaluate
function is superfluous here, so I'll remove that one too:
bivT = MultivariateTDistribution[{{1, rho}, {rho, 1}}, nu]
bivTCond[x_, y_, nu_, rho_] =
PDF[bivT, {x, y, nu, rho}] / PDF[StudentTDistribution[0, 1, nu], {x, nu}]
Out test experssion still won't evaluate to a numerical quantity though:
bivTCond[1, 1, 3, 0.5]
(*
==> {(
8 Pi PDF[
MultivariateTDistribution[{{1, 0.5}, {0.5, 1}}, 3], {1, 1, 3,
0.5}])/(3 Sqrt[3]),
8 Sqrt[3] Pi PDF[
MultivariateTDistribution[{{1, 0.5}, {0.5, 1}}, 3], {1, 1, 3,
0.5}]}
*)
The reason for this is that PDF
was used with the wrong syntax. Check any of the examples on the doc page of MultivariateTDistribution
to see how to use it: the parameters should not be included in the second argument of PDF
Let's fix this too:
bivT = MultivariateTDistribution[{{1, rho}, {rho, 1}}, nu]
bivTCond[x_, y_, nu_, rho_] =
PDF[bivT, {x, y}]/PDF[StudentTDistribution[0, 1, nu], {x, nu}]
And now it works:
Plot[bivTCond[1, y, 3, 0.5], {y, -3, 3}]

The morale here is: build up your expressions step by step, checking that they work at each stage! Then you'll catch mistakes early. This is how all of us work, and how we debug these problems.
Evaluate[PDF[...]]/Evaluate[PDF[...]]
doesn't really do anything, sinceEvaluate
is only special when it's at the first level (which is/
in this case.) Perhaps you meant to useEvaluate[PDF[...]/PDF[...]]
? $\endgroup$