From Łukasz Graczykowski
Exercise
Part one: Chi-squared distribution (3 pkt.)
Write a script which will draw the chi-squared probability distribution and it's cumulative distribution for number of degrees of freedom in the range: n=1..20
.
Part two: Fitting of the Gaussian function (2 pkt.)
Write a script which will perform a convolution of n uniform distributions. The value of n compute as a minimal number of convolutions, for which the value of chi2/ndf, calculated from the fit of the Gaussian function is lower than 1.0 (we use the method Fit
from the TF1 class).
Attention
- We move to the second part of our class - until now we have considered only properties of the probability distributions. Now we will move to the methods of finding the parameters (estimation) of those distributions from the random sample (experiment).
- We read Lecture 9 link - especially slides about the chi-squred distribution (22-27) - the best is to read the about the estimators.
- In the first part for chi-squared distribution we used the gamma function from (
TMath::Gamma
)
- In the second part we perform n convolutions of uniform distributions and the resulting histogram should be fitted with the Gaussian function - it should be a loop (i.e.
while
or do-while
), which we break when the value of the test statistics chi-squared (X^2) divided by the number of degrees of freedom (NDF) is lower than 1. To calculate X^2 and NDF there are appropriate methods in the TF1 class
Result
Chi-squared distribution
Fit of the Gaussian function
Result (example):
number of convoluted distributions = 9
chi2/ndf = 55.724/59 = 0.944475