[likelihood] fixed plots for exercise
This commit is contained in:
parent
deed303596
commit
0cd4165858
@ -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
|
||||
|
@ -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);
|
||||
|
BIN
likelihood/exercises/mlepropest.pdf
Normal file
BIN
likelihood/exercises/mlepropest.pdf
Normal file
Binary file not shown.
@ -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);
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user