<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?action=history&amp;feed=atom&amp;title=KADD_2022_Laboratorium_10_EN</id>
		<title>KADD 2022 Laboratorium 10 EN - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?action=history&amp;feed=atom&amp;title=KADD_2022_Laboratorium_10_EN"/>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;action=history"/>
		<updated>2026-05-14T02:30:46Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.16.5</generator>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2943&amp;oldid=prev</id>
		<title>Lgraczyk: /* Attention */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2943&amp;oldid=prev"/>
				<updated>2022-05-16T11:25:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Attention&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:25, 16 May 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* There are two lines in the graph below (histogram) - blue and red. One is an auto-fit with &amp;lt;code&amp;gt; Fit &amp;lt;/code&amp;gt;, the other is a manual procedure described above.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* There are two lines in the graph below (histogram) - blue and red. One is an auto-fit with &amp;lt;code&amp;gt; Fit &amp;lt;/code&amp;gt;, the other is a manual procedure described above.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* For the Poisson distribution in the form of such &amp;quot;steps&amp;quot; we use the function &amp;lt;code&amp;gt; TMath :: PoissonI &amp;lt;/code&amp;gt; ([https://root.cern.ch/root/html534/TMath.html#TMath:PoissonI link])&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* For the Poisson distribution in the form of such &amp;quot;steps&amp;quot; we use the function &amp;lt;code&amp;gt; TMath :: PoissonI &amp;lt;/code&amp;gt; ([https://root.cern.ch/root/html534/TMath.html#TMath:PoissonI link])&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* The quantile of the chi-square distribution with the appropriate number of degrees of freedom to perform the test can be read from Exercise 9 (previous classes) - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;so &lt;/del&gt;we drew these chi-square distributions.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* The quantile of the chi-square distribution with the appropriate number of degrees of freedom to perform the test can be read from Exercise 9 (previous classes) - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;that is why &lt;/ins&gt;we drew these chi-square distributions &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;last time&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Result ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Result ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2942&amp;oldid=prev</id>
		<title>Lgraczyk: /* Attention */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2942&amp;oldid=prev"/>
				<updated>2022-05-16T11:25:03Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Attention&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:25, 16 May 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Attention ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Attention ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Nasze zadanie &lt;/del&gt;to '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ręczne&lt;/del&gt;'&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'' przeprowadzenie czynności wykonywanych automatycznie przez funkcję &lt;/del&gt;&amp;lt;code&amp;gt;Fit&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Our task is &lt;/ins&gt;to ''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;manually&lt;/ins&gt;'' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;carry out the actions performed automatically by the &lt;/ins&gt;&amp;lt;code&amp;gt; Fit &amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Zadanie zawiera w sobie dwie części&lt;/del&gt;: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wyznaczenie parametru rozkładu Poissona &lt;/del&gt;''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'metodą największej wiarygodności''' (&lt;/del&gt;maximum likelihood&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;), szukając &lt;/del&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;estymatora o najniższej wariancji&lt;/del&gt;'''. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Czytamy zatem&lt;/del&gt;: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wykład 9 [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad9-2019.pdf link] - o metodzie największej wiarygodności, od początku do slajdu 24 (to są części teoretyczne z wyprowadzeniami), dalej Wykład &lt;/del&gt;10 [http://www.if.pw.edu.pl/~lgraczyk/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;KADD2019&lt;/del&gt;/Wyklad10-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2019&lt;/del&gt;.pdf link]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The problem consists of two parts&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;determining the parameter of the Poisson distribution &lt;/ins&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;by the &lt;/ins&gt;maximum likelihood &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;method&lt;/ins&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, looking for the &lt;/ins&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;estimator with the lowest variance&lt;/ins&gt;''. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;So we read&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Lecture &lt;/ins&gt;10 [http://www.if.pw.edu.pl/~lgraczyk/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;KADD2022&lt;/ins&gt;/Wyklad10-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;2022&lt;/ins&gt;.pdf link] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;- about the maximum likelihood method for Poissonian distribution&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Funkcja wiarygodności to ogólnie rzecz biorąc funkcja rozkładu prawdopodobieństwa dla &lt;/del&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;parametrów&lt;/del&gt;'&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'' badanego rozkładu&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;okreslana na podstawie próby losowej &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;jeżeli badamy np. rozkład wzrostu Polaków &lt;/del&gt;f(x), &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gdzie &lt;/del&gt;X &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to zmienna losowa okreslająca wzrost Polaków&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;np&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;rozkład Gaussa o dwóch parametrach &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;średnia&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;odchylenie&lt;/del&gt;), &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to &lt;/del&gt;L &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;będzie funkcją wiarygodności&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;rozkładem prawdopodobieństwa parametrów średniej i odchylenia &lt;/del&gt;-&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;szukamy maksimum funkcji &lt;/del&gt;L, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;które da nam najbardziej wiarygodne wartości parametrów średnia i odchylenie funkcji &lt;/del&gt;f(x))&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The likelihood function is, in general, a probability distribution function for the &lt;/ins&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;parameters&lt;/ins&gt;'' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;of the analyzed distribution&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;determined on the basis of a random sample &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if, for example, we study the growth distribution of Poles &lt;/ins&gt;f (x), &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;where &lt;/ins&gt;X &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is a random variable determining the height of Poles&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;e&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;g. Gaussian distribution with two parameters &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;mean&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;deviation&lt;/ins&gt;), &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;then &lt;/ins&gt;L &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;will be the likelihood function&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;probability distribution of the parameters of the mean and deviation &lt;/ins&gt;-&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we are looking for the maximum of the &lt;/ins&gt;L &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;which will give us the most reliable values ​​of the parameters mean and deviation of the function &lt;/ins&gt;f (x))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Szukanie parametrów metodą największej wiarygodności polega na rozwiązaniu równań wiarygodności&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;które są niczym innym tylko warunkami koniecznymi na istnienie maksimum funkcji &lt;/del&gt;L (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;zgodnie z analizą matematyczna &lt;/del&gt;- &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;liczymy odpowiednie pochodne&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Searching for parameters using the maximum likelihood method consists in solving the likelihood equations&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;which are nothing more than the conditions necessary for the existence of the maximum of the &lt;/ins&gt;L &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;according to the mathematical analysis &lt;/ins&gt;- &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we calculate the appropriate derivatives&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Dla rozkładu Poissona estymator o najniższej wariancji otrzymany metodą największej wiarygodności wynika z rozwiązania równania wiarygodności &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;jedno równanie&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;bo jeden parametr &lt;/del&gt;Lambda) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;- slajd 14 na Wykładzie 11 &lt;/del&gt;[http://www.if.pw.edu.pl/~lgraczyk/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;KADD2019&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wyklad11&lt;/del&gt;-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2019&lt;/del&gt;.pdf link]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;For the Poisson distribution, the estimator with the lowest variance obtained by the maximum likelihood method results from the solution of the likelihood equation &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;one equation&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because one &lt;/ins&gt;Lambda &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;parameter&lt;/ins&gt;) [http://www.if.pw.edu.pl/~lgraczyk/ &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;KADD2022 &lt;/ins&gt;/ &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Wyklad10&lt;/ins&gt;-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;2022&lt;/ins&gt;.pdf link]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Druga część&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;po znalezieniu estymatora o najwyższej wiarygodności&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;polega na przeprowadzeniu testu &lt;/del&gt;chi-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;kwadrat. W tym celu czytamy dokładnie Wykład 11 (zwłaszcza slajdy 7-16) [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad11-2019.pdf link]&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The second part&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;after finding the estimator with the highest likelihood&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is to perform a &lt;/ins&gt;chi-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;square test&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;For this purpose, we read carefully Lecture 10&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Na wykresie poniżej &lt;/del&gt;(histogram) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;są dwie linie &lt;/del&gt;- &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;niebieska i czerwona&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Jedna z nich to dopasowanie dokonane automatycznie funkcją &lt;/del&gt;&amp;lt;code&amp;gt;Fit&amp;lt;/code&amp;gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;druga to ręczne dopasowanie sposeb powyżej&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;There are two lines in the graph below &lt;/ins&gt;(histogram) - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;blue and red&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;One is an auto-fit with &lt;/ins&gt;&amp;lt;code&amp;gt; Fit &amp;lt;/code&amp;gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the other is a manual procedure described above&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Do rozkładu Poissona w postaci takich &lt;/del&gt;&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;schodków&lt;/del&gt;&amp;quot; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;stosujemy funkcję &lt;/del&gt;&amp;lt;code&amp;gt;TMath::PoissonI&amp;lt;/code&amp;gt; ([https://root.cern.ch/root/html534/TMath.html#TMath:PoissonI link])&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;For the Poisson distribution in the form of such &lt;/ins&gt;&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;steps&lt;/ins&gt;&amp;quot; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we use the function &lt;/ins&gt;&amp;lt;code&amp;gt; TMath :: PoissonI &amp;lt;/code&amp;gt; ([https://root.cern.ch/root/html534/TMath.html#TMath:PoissonI link])&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Kwantyl rozkładu &lt;/del&gt;chi-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;kwadrat o odpowiedniej liczbie stopni swobody do wykonania testu możemy odczytać z '''Zadania &lt;/del&gt;9&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''' &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;poprzednie zajęcia&lt;/del&gt;) - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;po to żeśmy te rozkłady &lt;/del&gt;chi-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;kwadrat rysowali&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The quantile of the &lt;/ins&gt;chi-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;square distribution with the appropriate number of degrees of freedom to perform the test can be read from Exercise &lt;/ins&gt;9 (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;previous classes&lt;/ins&gt;) - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;so we drew these &lt;/ins&gt;chi-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;square distributions&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Result ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Result ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2940&amp;oldid=prev</id>
		<title>Lgraczyk: /* Exercise */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2940&amp;oldid=prev"/>
				<updated>2022-05-16T11:20:41Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercise&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:20, 16 May 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Statistical hypotheses testing''' (5 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Statistical hypotheses testing''' (5 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* The experiment of irradiating a hydrogen bubble chamber with a beam of photons was carried out in order to study the interaction of photons with protons. Photons create electron-positron pairs that can be used to monitor the photon beam. The frequency of images with 0,1,2, ... electron-positron pairs should follow the Poisson distribution. Data should be read from the [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt file] (the first column shows the number of electron pairs in the image &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, and the second column shows the number of photos containing &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; electron pairs). We can see that this distribution resembles the Poisson distribution - therefore we are trying to calculate the maximum likelihood estimator for the parameters of the Poisson distribution (see [http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad10-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2019&lt;/del&gt;.pdf Lecture 10]) (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* The experiment of irradiating a hydrogen bubble chamber with a beam of photons was carried out in order to study the interaction of photons with protons. Photons create electron-positron pairs that can be used to monitor the photon beam. The frequency of images with 0,1,2, ... electron-positron pairs should follow the Poisson distribution. Data should be read from the [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt file] (the first column shows the number of electron pairs in the image &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, and the second column shows the number of photos containing &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; electron pairs). We can see that this distribution resembles the Poisson distribution - therefore we are trying to calculate the maximum likelihood estimator for the parameters of the Poisson distribution (see [http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad10-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;2022&lt;/ins&gt;.pdf Lecture 10]) (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2939&amp;oldid=prev</id>
		<title>Lgraczyk: /* Exercise */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2939&amp;oldid=prev"/>
				<updated>2022-05-16T11:20:23Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercise&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:20, 16 May 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Sprawdzić jakość dopasowania za pomocą testu &lt;/del&gt;χ2. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;W tym celu należy zaimplementować funkcję obliczającą statystykę testową &lt;/del&gt;χ2 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;zgodnie z wzorem &lt;/del&gt;[[File:wzor.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Check the quality of the fit with the &lt;/ins&gt;χ2 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;test&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;For this purpose, a function for calculating the &lt;/ins&gt;χ2 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;test statistic should be implemented according to the formul &lt;/ins&gt;[[File:wzor.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gdzie&lt;/del&gt;: nk - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;liczba obserwacji w k-tym binie&lt;/del&gt;, npk - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;przewidywana przez teorię liczba przypadków w k-tym binie tj&lt;/del&gt;.:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;where&lt;/ins&gt;: nk - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;number of observations in the kth bin&lt;/ins&gt;, npk - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the number of cases predicted by the theory in the kth bin, i.e &lt;/ins&gt;.:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; // h - histogram &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;danych&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; // h - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;data &lt;/ins&gt;histogram&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; // g - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;przewidywanie &lt;/del&gt;&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;teoretyczne&lt;/del&gt;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; // g - &amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;theoretical&lt;/ins&gt;&amp;quot; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;prediction&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; double chi2(TH1D *h, TF1 *f);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; double chi2(TH1D *h, TF1 *f);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Okreslić liczbę stopni swobody i obliczyć wartość statystyki testowej&lt;/del&gt;. (1 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pkt.&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Determine the number of degrees of freedom and calculate the value of the test statistic&lt;/ins&gt;. (1 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;pt&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Zaimplementować funkcję zwracającą wynik testu &lt;/del&gt;χ2 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;na zadanym poziomie istotności &lt;/del&gt;α &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;tj&lt;/del&gt;.:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Implement a function that returns the result of the &lt;/ins&gt;χ2 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;test at a given significance level &lt;/ins&gt;α&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, i.e &lt;/ins&gt;.:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;// true - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;brak podstaw do odrzucenia hipotezy&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;nbsp; &lt;/ins&gt;// true - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;there is no reason to reject the hypothesis&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;// false - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;sa podstawy do odrzucenia hipotezy&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;nbsp; &lt;/ins&gt;// false - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;there are grounds for rejecting the hypothesis&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;// &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Parametry&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;nbsp; &lt;/ins&gt;// &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Parameters&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;// T - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wartosc statystyki testowej &lt;/del&gt;chi2&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;nbsp; &lt;/ins&gt;// T - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;value of the &lt;/ins&gt;chi2 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;test statistic&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;// alpha - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;poziom istotnosci&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;nbsp; &lt;/ins&gt;// alpha - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;significance level&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;// ndf - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;liczba stopni swobody rozkladu &lt;/del&gt;chi2&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;nbsp; &lt;/ins&gt;// ndf - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the number of degrees of freedom of &lt;/ins&gt;chi2 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;distribution&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; bool testChi2(double T, double alpha, int ndf);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; bool testChi2(double T, double alpha, int ndf);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wykorzystując zaimplementowaną funkcję zweryfikować hipotezę mówiacą&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;że dane pomiarowe podlegają rozkładowi Poissona&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Dobrać odpowiednią wartość poziomu istotności&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Uwaga&lt;/del&gt;! Kwanyl &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;możemy odczytać z policzonej na ostatnich zajęciach dystrybuanty&lt;/del&gt;. (2 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pkt.&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Using the implemented function&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;verify the hypothesis that the measurement data are subject to the Poisson distribution&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Select the appropriate value for the significance level&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Warning&lt;/ins&gt;! Kwanyl &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;can be read from the distribution box counted in the last class&lt;/ins&gt;. (2 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;pts&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Attention ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Attention ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2938&amp;oldid=prev</id>
		<title>Lgraczyk: /* Exercise */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2938&amp;oldid=prev"/>
				<updated>2022-05-16T11:17:21Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercise&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:17, 16 May 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Statistical hypotheses testing''' (5 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Statistical hypotheses testing''' (5 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* The experiment of irradiating a hydrogen bubble chamber with a beam of photons was carried out in order to study the interaction of photons with protons. Photons create electron-positron pairs that can be used to monitor the photon beam. The frequency of images with 0,1,2, ... electron-positron pairs should follow the Poisson distribution. Data should be read from the [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt file] (the first column shows the number of electron pairs in the image &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, and the second column shows the number of photos containing &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; electron pairs). We can see that this distribution resembles the Poisson distribution - therefore we are trying to calculate the maximum likelihood estimator for the parameters of the Poisson distribution (see[http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad10-2019.pdf Lecture 10]) (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* The experiment of irradiating a hydrogen bubble chamber with a beam of photons was carried out in order to study the interaction of photons with protons. Photons create electron-positron pairs that can be used to monitor the photon beam. The frequency of images with 0,1,2, ... electron-positron pairs should follow the Poisson distribution. Data should be read from the [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt file] (the first column shows the number of electron pairs in the image &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, and the second column shows the number of photos containing &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; electron pairs). We can see that this distribution resembles the Poisson distribution - therefore we are trying to calculate the maximum likelihood estimator for the parameters of the Poisson distribution (see [http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad10-2019.pdf Lecture 10]) (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2937&amp;oldid=prev</id>
		<title>Lgraczyk: /* Exercise */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2937&amp;oldid=prev"/>
				<updated>2022-05-16T11:17:12Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercise&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:17, 16 May 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Statistical hypotheses testing''' (5 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Statistical hypotheses testing''' (5 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Przeprowadzono eksperyment naświetlania wodorowej komory pęcherzykowej wiązką fotonów w celu&amp;nbsp; badania oddziaływań fotonów z protonami&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Fotony powodują powstawanie par elektron&lt;/del&gt;-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pozyton, które mogą być wykorzystane do monitorowania wiązki fotonów&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Częstość występowania zdjęć z &lt;/del&gt;0,1,2,... &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;parami elektron&lt;/del&gt;-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pozyton powinna podlegać rozkładowi Poissona&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Należy wczytać dane z &lt;/del&gt;[http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pliku&lt;/del&gt;] (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;w pierwszej kolumnie znajduje się liczba par elektronowych na zdjęciu &lt;/del&gt;&amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a w drugiej liczba zdjęć zawierających &lt;/del&gt;&amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;par elektronowych&lt;/del&gt;). &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Widzimy, że rozkład ten przypomina rozkład Poissona &lt;/del&gt;- &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;próbujemy zatem obliczyć estymator największej wiarygodności dla parametry rozkładu Poissona &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;patrz &lt;/del&gt;[http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad10-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2022&lt;/del&gt;.pdf &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wykład &lt;/del&gt;10]) (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The experiment of irradiating a hydrogen bubble chamber with a beam of photons was carried out in order to study the interaction of photons with protons&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Photons create electron&lt;/ins&gt;-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;positron pairs that can be used to monitor the photon beam&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The frequency of images with &lt;/ins&gt;0,1,2, ... &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;electron&lt;/ins&gt;-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;positron pairs should follow the Poisson distribution&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Data should be read from the &lt;/ins&gt;[http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;file&lt;/ins&gt;] (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the first column shows the number of electron pairs in the image &lt;/ins&gt;&amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and the second column shows the number of photos containing &lt;/ins&gt;&amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;electron pairs&lt;/ins&gt;). &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;We can see that this distribution resembles the Poisson distribution &lt;/ins&gt;- &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;therefore we are trying to calculate the maximum likelihood estimator for the parameters of the Poisson distribution &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;see&lt;/ins&gt;[http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad10-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;2019&lt;/ins&gt;.pdf &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Lecture &lt;/ins&gt;10]) (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2935&amp;oldid=prev</id>
		<title>Lgraczyk at 11:02, 16 May 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2935&amp;oldid=prev"/>
				<updated>2022-05-16T11:02:43Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:02, 16 May 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Zadanie &lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Exercise &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Weryfikacja hipotez statystycznych&lt;/del&gt;''' (5 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Statistical hypotheses testing&lt;/ins&gt;''' (5 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Przeprowadzono eksperyment naświetlania wodorowej komory pęcherzykowej wiązką fotonów w celu&amp;nbsp; badania oddziaływań fotonów z protonami. Fotony powodują powstawanie par elektron-pozyton, które mogą być wykorzystane do monitorowania wiązki fotonów. Częstość występowania zdjęć z 0,1,2,... parami elektron-pozyton powinna podlegać rozkładowi Poissona. Należy wczytać dane z [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt pliku] (w pierwszej kolumnie znajduje się liczba par elektronowych na zdjęciu &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, a w drugiej liczba zdjęć zawierających &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; par elektronowych). Widzimy, że rozkład ten przypomina rozkład Poissona - próbujemy zatem obliczyć estymator największej wiarygodności dla parametry rozkładu Poissona (patrz [http://www.if.pw.edu.pl/~lgraczyk/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;KADD2019&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wyklad11&lt;/del&gt;-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2019&lt;/del&gt;.pdf Wykład &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;11&lt;/del&gt;] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;slajd 14&lt;/del&gt;) (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Przeprowadzono eksperyment naświetlania wodorowej komory pęcherzykowej wiązką fotonów w celu&amp;nbsp; badania oddziaływań fotonów z protonami. Fotony powodują powstawanie par elektron-pozyton, które mogą być wykorzystane do monitorowania wiązki fotonów. Częstość występowania zdjęć z 0,1,2,... parami elektron-pozyton powinna podlegać rozkładowi Poissona. Należy wczytać dane z [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt pliku] (w pierwszej kolumnie znajduje się liczba par elektronowych na zdjęciu &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, a w drugiej liczba zdjęć zawierających &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; par elektronowych). Widzimy, że rozkład ten przypomina rozkład Poissona - próbujemy zatem obliczyć estymator największej wiarygodności dla parametry rozkładu Poissona (patrz [http://www.if.pw.edu.pl/~lgraczyk/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;KADD2022&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Wyklad10&lt;/ins&gt;-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;2022&lt;/ins&gt;.pdf Wykład &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;10&lt;/ins&gt;]) (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Wykorzystując zaimplementowaną funkcję zweryfikować hipotezę mówiacą, że dane pomiarowe podlegają rozkładowi Poissona. Dobrać odpowiednią wartość poziomu istotności. Uwaga! Kwanyl możemy odczytać z policzonej na ostatnich zajęciach dystrybuanty. (2 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Wykorzystując zaimplementowaną funkcję zweryfikować hipotezę mówiacą, że dane pomiarowe podlegają rozkładowi Poissona. Dobrać odpowiednią wartość poziomu istotności. Uwaga! Kwanyl możemy odczytać z policzonej na ostatnich zajęciach dystrybuanty. (2 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Uwagi &lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Attention &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Nasze zadanie to '''ręczne''' przeprowadzenie czynności wykonywanych automatycznie przez funkcję &amp;lt;code&amp;gt;Fit&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Nasze zadanie to '''ręczne''' przeprowadzenie czynności wykonywanych automatycznie przez funkcję &amp;lt;code&amp;gt;Fit&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Zadanie zawiera w sobie dwie części: wyznaczenie parametru rozkładu Poissona '''metodą największej wiarygodności''' (maximum likelihood), szukając '''estymatora o najniższej wariancji'''. Czytamy zatem: Wykład 9 [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad9-2019.pdf link] - o metodzie największej wiarygodności, od początku do slajdu 24 (to są części teoretyczne z wyprowadzeniami), dalej Wykład 10 [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad10-2019.pdf link]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Zadanie zawiera w sobie dwie części: wyznaczenie parametru rozkładu Poissona '''metodą największej wiarygodności''' (maximum likelihood), szukając '''estymatora o najniższej wariancji'''. Czytamy zatem: Wykład 9 [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad9-2019.pdf link] - o metodzie największej wiarygodności, od początku do slajdu 24 (to są części teoretyczne z wyprowadzeniami), dalej Wykład 10 [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad10-2019.pdf link]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 37:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 37:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Kwantyl rozkładu chi-kwadrat o odpowiedniej liczbie stopni swobody do wykonania testu możemy odczytać z '''Zadania 9''' (poprzednie zajęcia) - po to żeśmy te rozkłady chi-kwadrat rysowali.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* Kwantyl rozkładu chi-kwadrat o odpowiedniej liczbie stopni swobody do wykonania testu możemy odczytać z '''Zadania 9''' (poprzednie zajęcia) - po to żeśmy te rozkłady chi-kwadrat rysowali.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wynik &lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Result &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:Lab10_2.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:Lab10_2.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 50:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 50:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;  ERR DEF= 0.5&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;  ERR DEF= 0.5&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; Lambda &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;najwiekszej wiarygodnosci&lt;/del&gt;: 2.33239&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; Lambda &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;of the highest likelihood&lt;/ins&gt;: 2.33239&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; Lambda (ROOT Fit): 2.33737&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; Lambda (ROOT Fit): 2.33737&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; chi2 (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wartosc statystyki testowej &lt;/del&gt;T): 10.5336&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; chi2 (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;value of the test statistics &lt;/ins&gt;T): 10.5336&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; chi2/NDF: 1.7556&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; chi2/NDF: 1.7556&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; chi2 (ROOT Fit): 9.85507&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; chi2 (ROOT Fit): 9.85507&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; chi2 (ROOT Fit)/NDF: 1.40787&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; chi2 (ROOT Fit)/NDF: 1.40787&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Poziom istotnosci &lt;/del&gt;alpha: 0.01&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Significance level &lt;/ins&gt;alpha: 0.01&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wynik testu&lt;/del&gt;: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nie ma podstaw do odrzucenia hipotezy&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Test result&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;no grounds to reject the null hypothesis&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2934&amp;oldid=prev</id>
		<title>Lgraczyk: Created page with &quot;== Zadanie == '''Weryfikacja hipotez statystycznych''' (5 pkt.)  * Przeprowadzono eksperyment naświetlania wodorowej komory pęcherzykowej wiązką fotonów w celu  badania oddz...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_10_EN&amp;diff=2934&amp;oldid=prev"/>
				<updated>2022-05-16T11:00:27Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Zadanie == &amp;#39;&amp;#39;&amp;#39;Weryfikacja hipotez statystycznych&amp;#39;&amp;#39;&amp;#39; (5 pkt.)  * Przeprowadzono eksperyment naświetlania wodorowej komory pęcherzykowej wiązką fotonów w celu  badania oddz...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Zadanie ==&lt;br /&gt;
'''Weryfikacja hipotez statystycznych''' (5 pkt.)&lt;br /&gt;
&lt;br /&gt;
* Przeprowadzono eksperyment naświetlania wodorowej komory pęcherzykowej wiązką fotonów w celu  badania oddziaływań fotonów z protonami. Fotony powodują powstawanie par elektron-pozyton, które mogą być wykorzystane do monitorowania wiązki fotonów. Częstość występowania zdjęć z 0,1,2,... parami elektron-pozyton powinna podlegać rozkładowi Poissona. Należy wczytać dane z [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/lab10/dane10.txt pliku] (w pierwszej kolumnie znajduje się liczba par elektronowych na zdjęciu &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt;, a w drugiej liczba zdjęć zawierających &amp;lt;code&amp;gt;k&amp;lt;/code&amp;gt; par elektronowych). Widzimy, że rozkład ten przypomina rozkład Poissona - próbujemy zatem obliczyć estymator największej wiarygodności dla parametry rozkładu Poissona (patrz [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad11-2019.pdf Wykład 11] slajd 14) (1 pkt.)&lt;br /&gt;
&lt;br /&gt;
* Narysować na jednym wykresie punkty pomiarowe i dopasowanie (metodą estymatora największej wiarygodności i funkcją Fit z ROOT'a użytą z parametrami &amp;quot;LR&amp;quot; - dopasowanie metodą największej wiarygodności). Funkcja TF1 do rysowania (i dopasowania ROOT'em) to TMath::PoissonI (1 pkt.)&lt;br /&gt;
&lt;br /&gt;
* Sprawdzić jakość dopasowania za pomocą testu χ2. W tym celu należy zaimplementować funkcję obliczającą statystykę testową χ2 zgodnie z wzorem [[File:wzor.png]]&lt;br /&gt;
gdzie: nk - liczba obserwacji w k-tym binie, npk - przewidywana przez teorię liczba przypadków w k-tym binie tj.:&lt;br /&gt;
&lt;br /&gt;
 // h - histogram danych&lt;br /&gt;
 // g - przewidywanie &amp;quot;teoretyczne&amp;quot;&lt;br /&gt;
 double chi2(TH1D *h, TF1 *f);&lt;br /&gt;
&lt;br /&gt;
* Okreslić liczbę stopni swobody i obliczyć wartość statystyki testowej. (1 pkt.)&lt;br /&gt;
&lt;br /&gt;
* Zaimplementować funkcję zwracającą wynik testu χ2 na zadanym poziomie istotności α tj.:&lt;br /&gt;
 // true - brak podstaw do odrzucenia hipotezy&lt;br /&gt;
 // false - sa podstawy do odrzucenia hipotezy&lt;br /&gt;
 // Parametry:&lt;br /&gt;
 // T - wartosc statystyki testowej chi2&lt;br /&gt;
 // alpha - poziom istotnosci&lt;br /&gt;
 // ndf - liczba stopni swobody rozkladu chi2&lt;br /&gt;
 bool testChi2(double T, double alpha, int ndf);&lt;br /&gt;
&lt;br /&gt;
Wykorzystując zaimplementowaną funkcję zweryfikować hipotezę mówiacą, że dane pomiarowe podlegają rozkładowi Poissona. Dobrać odpowiednią wartość poziomu istotności. Uwaga! Kwanyl możemy odczytać z policzonej na ostatnich zajęciach dystrybuanty. (2 pkt.)&lt;br /&gt;
&lt;br /&gt;
== Uwagi ==&lt;br /&gt;
* Nasze zadanie to '''ręczne''' przeprowadzenie czynności wykonywanych automatycznie przez funkcję &amp;lt;code&amp;gt;Fit&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Zadanie zawiera w sobie dwie części: wyznaczenie parametru rozkładu Poissona '''metodą największej wiarygodności''' (maximum likelihood), szukając '''estymatora o najniższej wariancji'''. Czytamy zatem: Wykład 9 [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad9-2019.pdf link] - o metodzie największej wiarygodności, od początku do slajdu 24 (to są części teoretyczne z wyprowadzeniami), dalej Wykład 10 [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad10-2019.pdf link]&lt;br /&gt;
* Funkcja wiarygodności to ogólnie rzecz biorąc funkcja rozkładu prawdopodobieństwa dla '''parametrów''' badanego rozkładu, okreslana na podstawie próby losowej (jeżeli badamy np. rozkład wzrostu Polaków f(x), gdzie X to zmienna losowa okreslająca wzrost Polaków, np. rozkład Gaussa o dwóch parametrach (średnia, odchylenie), to L będzie funkcją wiarygodności, rozkładem prawdopodobieństwa parametrów średniej i odchylenia -&amp;gt; szukamy maksimum funkcji L, które da nam najbardziej wiarygodne wartości parametrów średnia i odchylenie funkcji f(x))&lt;br /&gt;
* Szukanie parametrów metodą największej wiarygodności polega na rozwiązaniu równań wiarygodności, które są niczym innym tylko warunkami koniecznymi na istnienie maksimum funkcji L (zgodnie z analizą matematyczna - liczymy odpowiednie pochodne)&lt;br /&gt;
* Dla rozkładu Poissona estymator o najniższej wariancji otrzymany metodą największej wiarygodności wynika z rozwiązania równania wiarygodności (jedno równanie, bo jeden parametr Lambda) - slajd 14 na Wykładzie 11 [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad11-2019.pdf link]&lt;br /&gt;
* Druga część, po znalezieniu estymatora o najwyższej wiarygodności, polega na przeprowadzeniu testu chi-kwadrat. W tym celu czytamy dokładnie Wykład 11 (zwłaszcza slajdy 7-16) [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad11-2019.pdf link].&lt;br /&gt;
* Na wykresie poniżej (histogram) są dwie linie - niebieska i czerwona. Jedna z nich to dopasowanie dokonane automatycznie funkcją &amp;lt;code&amp;gt;Fit&amp;lt;/code&amp;gt;, druga to ręczne dopasowanie sposeb powyżej.&lt;br /&gt;
* Do rozkładu Poissona w postaci takich &amp;quot;schodków&amp;quot; stosujemy funkcję &amp;lt;code&amp;gt;TMath::PoissonI&amp;lt;/code&amp;gt; ([https://root.cern.ch/root/html534/TMath.html#TMath:PoissonI link])&lt;br /&gt;
* Kwantyl rozkładu chi-kwadrat o odpowiedniej liczbie stopni swobody do wykonania testu możemy odczytać z '''Zadania 9''' (poprzednie zajęcia) - po to żeśmy te rozkłady chi-kwadrat rysowali.&lt;br /&gt;
&lt;br /&gt;
== Wynik ==&lt;br /&gt;
&lt;br /&gt;
[[File:Lab10_2.png]]&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
 FCN=5.75356 FROM MIGRAD    STATUS=CONVERGED      29 CALLS          30 TOTAL&lt;br /&gt;
                     EDM=5.17016e-07    STRATEGY= 1      ERROR MATRIX ACCURATE &lt;br /&gt;
  EXT PARAMETER                                   STEP         FIRST   &lt;br /&gt;
  NO.   NAME      VALUE            ERROR          SIZE      DERIVATIVE &lt;br /&gt;
   1  p0           3.55268e+02   1.88558e+01   3.25727e-02   3.68816e-05&lt;br /&gt;
   2  p1           2.33737e+00   8.17264e-02   1.40382e-04  -2.26405e-03&lt;br /&gt;
                               ERR DEF= 0.5&lt;br /&gt;
 &lt;br /&gt;
 Lambda najwiekszej wiarygodnosci: 2.33239&lt;br /&gt;
 Lambda (ROOT Fit): 2.33737&lt;br /&gt;
 chi2 (wartosc statystyki testowej T): 10.5336&lt;br /&gt;
 chi2/NDF: 1.7556&lt;br /&gt;
 chi2 (ROOT Fit): 9.85507&lt;br /&gt;
 chi2 (ROOT Fit)/NDF: 1.40787&lt;br /&gt;
 Poziom istotnosci alpha: 0.01&lt;br /&gt;
 Wynik testu: nie ma podstaw do odrzucenia hipotezy&lt;/div&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	</feed>