# Visualize the optimal point for distribution with three parameters

I want to visualize to any distribution with two or three parameter

dist = ProbabilityDistribution[λ Exp[λ (1 - x)], {x, 1, Infinity}, Assumptions -> λ > 0]
data = {1.4, 5.1, 1.7, 1.6, 1.1, 3.9, 2.2, 1.3, 2., 1.5};

param = FindDistributionParameters[data, dist]

Plot[
LogLikelihood[dist, data], {λ, .1, 2},
Epilog -> {PointSize[Medium], Red,
Point[{λ, LogLikelihood[dist, data]} /. param]}
]


• What is your question here? Commented Mar 31, 2021 at 14:32
• I want to draw the image for three parameters(image for each parameters) but I don't know how i write it? Commented Mar 31, 2021 at 14:43
• if anyone can draw for any distribution with two or three parameters to i do like him I will be thank for him Commented Mar 31, 2021 at 14:45

data = (SeedRandom[1234]; RandomVariate[
NormalDistribution[2, 1/2], 20])

(* {1.74583, 1.9647, 1.20305, 2.7683, 3.33901, 1.34158, 1.45272, 2.07147, \
2.05208, 1.16345, 2.01788, 2.08509, 2.46734, 1.58657, 1.95452, 2.5167, \
1.81824, 2.0943, 1.93193, 1.95803} *)

dist = NormalDistribution[m, s];

param = FindDistributionParameters[data, dist]

(* {m -> 1.97664, s -> 0.511284} *)

llf = LogLikelihood[dist, data] // Simplify

(* (-41.6851 + 39.5328 m - 10. m^2 - 18.3788 s^2 - 20. s^2 Log[s])/s^2 *)


Or manually calculating the llf

llf === (Total@Log[PDF[dist, #] & /@ data] // PowerExpand // Simplify)

(* True *)

Show[
Plot3D[llf,
{m, 1, 3}, {s, 1/4, 3/4},
AxesLabel -> (Style[#, 16, Bold] & /@
{"m", "s", "llf"}),
PlotStyle -> Opacity[0.7],
ClippingStyle -> None],
Graphics3D[{PointSize[Large], Red, Point[{m, s, llf} /. param]}]]


For a three-parameter distribution you need three plots, one each with one of the parameters fixed and plot the llf with the other two.

• how i ask about one each with one of the parameters fixed please? Commented Mar 31, 2021 at 15:59
• Set one of the parameters to its value in param and plot the llf as a two-parameter function of the other two parameters. Repeat for each parameter. Commented Mar 31, 2021 at 16:05
• couldn't draw 2d instead of 3d? Commented Mar 31, 2021 at 16:08
• To draw 2D you would need to fix two parameters and plot against the third. Again using multiple plots. Commented Mar 31, 2021 at 16:11
• Thanks you very much Commented Mar 31, 2021 at 16:24