diff --git a/likelihood/exercises/exercises01.tex b/likelihood/exercises/exercises01.tex index 4b3dae7..2596da6 100644 --- a/likelihood/exercises/exercises01.tex +++ b/likelihood/exercises/exercises01.tex @@ -107,7 +107,15 @@ of the standard deviation. \end{parts} \begin{solution} \lstinputlisting{mlestd.m} - \includegraphics[width=1\textwidth]{mlestd} + \includegraphics[width=1\textwidth]{mlestd}\\ + + The more data the smaller the product of the probabilities ($\approx + p^n$ with $0 \le p < 1$) and the smaller the sum of the logarithms + of the probabilities ($\approx n\log p$, note that $\log p < 0$). + + The product eventually gets smaller than the precision of the + floating point numbers support. Therefore for $n=1000$ the products + becomes zero. Using the logarithm avoids this numerical problem. \end{solution} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -151,7 +159,10 @@ standard deviation $\sigma_i$: \end{parts} \begin{solution} \lstinputlisting{mlepropest.m} - \includegraphics[width=1\textwidth]{mlepropest} + \includegraphics[width=1\textwidth]{mlepropest}\\ + The estimated slopes are centered around the true slope. The + standard deviation of the estimated slopes gets smaller for larger + $n$ and less noise in the data. \end{solution} \continue diff --git a/likelihood/exercises/mlepropest.m b/likelihood/exercises/mlepropest.m index b77171c..352c28c 100644 --- a/likelihood/exercises/mlepropest.m +++ b/likelihood/exercises/mlepropest.m @@ -18,8 +18,9 @@ for i = 1:length(sigmas) subplot(2, 2, 2*(i-1)+j); bins = [1.9:0.005:2.1]; hist(slopes, bins); + xlabel('estimated slope'); title(sprintf('sigma=%g, n=%d', sigma, n)); end end -savefigpdf(gcf, 'mlepropest.pdf', 12, 7); +savefigpdf(gcf, 'mlepropest.pdf', 15, 10); diff --git a/likelihood/exercises/mlepropest.pdf b/likelihood/exercises/mlepropest.pdf new file mode 100644 index 0000000..0a22974 Binary files /dev/null and b/likelihood/exercises/mlepropest.pdf differ diff --git a/likelihood/exercises/mlestd.m b/likelihood/exercises/mlestd.m index 149eaf7..f28d39e 100644 --- a/likelihood/exercises/mlestd.m +++ b/likelihood/exercises/mlestd.m @@ -32,4 +32,4 @@ for k = 1:length(ns) xlabel('standard deviation') ylabel('log likelihood') end -savefigpdf(gcf, 'mlestd.pdf', 15, 5); +savefigpdf(gcf, 'mlestd.pdf', 15, 10); diff --git a/likelihood/exercises/mlestd.pdf b/likelihood/exercises/mlestd.pdf index f01f927..5246eda 100644 Binary files a/likelihood/exercises/mlestd.pdf and b/likelihood/exercises/mlestd.pdf differ