Session 1
Exercise 1
- Simulate a number N of random points uniformly distributed inside a square.
- Count the fraction of these points that fall within the inscribed circle and use the result to estimate π. How does the accuracy of the evaluation depend on N?
- Plot the points in a graph, using different colors for those inside and outside the circle.
- Refine the plot by adding a title and axis labels, choosing the appropriate aspect ratio etc.
Exercise 2
- Load the data in file histogram.dat.
- Compute and plot the histogram of these values. How did you choose the range and bin size?
- Refine the plot as above.
Solutions
In Python: Solution_1.py
Session 2
Exercise 1
- Generate a number N of random values uniformly distributed in the interval [0 , 2].
- Plot their histogram.
- For each value k from 2 to 10 generate N values, each of them being the sum of k random values uniformly distributed in the interval [0 , 2].
- Plot the histogram of these values for each k.
Exercise 2
- Load the data in file Anscombe.txt. It contains four pairs of columns (xi, yi), for i ranging from 1 to 4.
- Compute the mean and standard deviation for each column. Compare these values for the x and y columns, respectively.
- Compute Pearson’s correlation coefficient r(xi, yi) for each pair. Compare these values.
- Plot the four graphs yi vs xi. How would you describe the data in each graph?
Solutions
In Python: Solution_2.py
Session 3
No practicals
Session 4
Exercise 1
- A sample of 100 individuals from a given population contains 56 women and 44 men.
- What can one say about the null hypothesis: "The (total) population is evenly distributed by gender"?
Exercise 2
Solve the dice fairness problem available here.Exercise 3
Solve Exercice 7.8 in [Barlow, 1993].Exercise 4
- You are given a small set of (<10) measurements of a physical parameter. Estimate the value of the parameter with 95% confidence. You will need Student's t distribution.
- What happens if you approximate Student's t distribution by the normal distribution?
Solutions
In Python: Solution_4.pySession 5
- Load and plot the data (x, y, σ) from file Tofit.txt.
- Perform a straight-line fit: y = a + bx
- Estimate the fit parameters a and b with 95% confidence. Compute the covariance Cov(a,b).
- Compute and display the confidence band at the same 95% level.
- Plot the scale residuals (use a common x axis with the graph at point 1.).
- Redo points 2. and 3. explicitly (using the weighted sums Sx, Sxx, Sxy, etc.)
Solutions
In Python: Solution_5.pySession 6
We will use two standard nonlinear regression datasets from the NIST. In both cases, the background is zero (the ε in the models represents the error).
Exercise 1
- Load and plot the data for set Eckerle 4. Implement the fitting function given with the data (a non-standard Gaussian with parameters β1, β2, and β3).
- Do the fit and give the best parameter values with 68% confidence. Display the residuals and compute the covariance matrix between the coefficients.
- Do you obtain the certified coefficients? How did your software deal with the lack of error bars?
- Normalize the covariance matrix to obtain the correlation matrix. Discuss the correlation between width and amplitude.
- [Homework] Plot the χ2 function for a range of ±2σ around the minimum for the amplitude and width (β1 and β2).
Exercise 2
- Load and plot the data for set Gauss 3. Implement the fitting function given with the data (Two Gaussians and an exponential background).
- Do the fit and give the best parameter values with 68% confidence. Display the residuals and compute the covariance matrix between the coefficients.
- Do you obtain the certified coefficients?
- Compute the histogram of the residuals. Choose the bin width carefully.
- Do a lag plot of the residues (with a 1-point lag). Display it in a “square” graph (x and y units should be equal).
- Normalize the covariance matrix to obtain the correlation matrix. Are there strong correlations between some coefficients? Why is that?
- [Homework] What is your confidence that the residuals are only due to Gaussian noise?
Solutions
In Python: Solution_6.py
No comments:
Post a Comment