# Maximum Likelihood

Let $x$ have an exponential density $p(x|\theta) = \theta e^{-\theta x} \text{ if }x \ge 0;\quad 0 \text{ otherwise.}$

a) Plot $p(x|\theta)$ versus $x$ for $\theta = 1$. Plot $p(x|\theta)$ versus $\theta$, $(0\le \theta \le 5)$ for $x = 2.$

How would I do this?

• What plotting techniques do you know? Let's be specific: part (a) asks you to graph the function $1 e^{-1 x} = e^{-x}$ for $x \ge 0$. Where exactly are you having trouble doing that? – whuber Mar 24 '13 at 21:44

The first part is simple: substitute $1$ for $\theta$ in the density equation, giving you $p(x|\theta=1)=\exp(- x)$. In this case, $x$ varies and $\theta$ remains fixed.
The second part treats $x$ as fixed and instead varies $\theta$. This can be done by generating a vector of, say, 1000 $\theta$ values between 0 and 5, and computing the density for $x=2$ at each value of $\theta$ in the vector. Plot the results.
• If we have a program capable of sketching curves such as $\exp(-x)$ (program picks where to evaluate the function, draws the axes, plots the curve, etc.), why can't we use the same program to sketch $\theta\exp(-2\theta)$? That is, why is it necessary to suggest taking 1000 values of $\theta$ between $0$ and $5$, calculate $\theta\exp(-2\theta)$ for each value, and then plot the results, but it is not necessary to make similar suggestions for plotting $\exp(-x)$? – Dilip Sarwate Mar 24 '13 at 22:19