• Home
  • Textbooks
  • A Student's Guide to Data and Error Analysis
  • Fitting functions to data

A Student's Guide to Data and Error Analysis

Herman J. C. Berendsen

Chapter 7

Fitting functions to data - all with Video Answers

Educators


Chapter Questions

Problem 1

Perform a linear regression on the enzyme kinetics data of Table 6.2 (page 76). Do this according to the Lineweaver-Burk plot, i.e., for $x=1 /[\mathrm{S}]$ en $y=1 / v$. Use correct standard inaccuracies for $y$. Give the values for $v_{\max }$ and $K_m$ with their standard inaccuracies (be aware that for an s.d. in a combination of $a$ and $b$ also the correlation coefficient between $a$ and $b$ is needed). Compare your values with the graphical estimates from Fig. 6.2 and with the nonlinear least-squares solution of the example on page 93. Plot the data points with the best-fitted straight line.

Check back soon!
02:29

Problem 2

The $\Delta G$ of a reaction was determined by measuring equilibrium constants at various temperatures. The following values were obtained:
$$
\begin{array}{cc}
\hline T / \mathrm{K} & \Delta G / \mathrm{kJ} \mathrm{mol}{ }^{-1} \\
\hline 270 & 40.3 \\
280 & 38.2 \\
290 & 36.1 \\
300 & 32.2 \\
310 & 29.1 \\
320 & 28.0 \\
330 & 25.3 \\
\hline
\end{array}
$$
The uncertainty in $T$ is negligible and the weight factors are equal for all cases. Determine the reaction entropy $\Delta S=-d \Delta G / d T$ by fitting the values of $\Delta G$ to a linear function of $T$. What is the standard inaccuracy in $\Delta S$ ? Extrapolate $\Delta G$ to $T=350 \mathrm{~K}$ and give the standard inaccuracy that follows from the variance and covariance of the parameters, as found from the least-squares fit. Now do the same thing, but take for $x$ the values of $T-300$ instead of $T$ itself. Discuss the differences (if any) between the two calculations.

Adriano Chikande
Adriano Chikande
Numerade Educator

Problem 3

Explain why the weight given to a data point $y_i=\log t_i$ should be proportional to $t_i^2$ if the $t_i$ 's are all random samples from probability distributions with the same variance. Start by deriving the variance of $y$ assuming a constant variance $\sigma_t^2$ of $t$. Then relate the weight to the variance.

Check back soon!

Problem 4

Perform a least-squares fit of the four-parameter double exponential function $a \exp (-p x)+b \exp (-q x)$ to the data $x, y$ from Table 6.1 on page 74. Use the Python program fit (code 7.7). As initial parameter guess use the values that were determined graphically in Section 6.2. If the minimization does not reach a result after the maximum number of trials, then take the last values of the parameters as initial ones and minimize again.

Check back soon!
07:19

Problem 5

You wish to measure the focal length of a positive lens on an optical bench with a ruler graduated in mm from 0 to 1000 . Your lens is placed somewhere near 190 mm but it is an encased thick lens and you are not sure about its exact position. Your object (a lamp) is placed at position $x$ and you observe the image to be sharp at position $y$. You estimate the s.d. $\sigma_y$ of $y$. All data are in mm .
$$
\begin{array}{rcr}
\hline x & y & \sigma_y \\
60 & 285 & 1 \\
80 & 301 & 2 \\
100 & 334 & 3 \\
110 & 383 & 4 \\
120 & 490 & 5 \\
125 & 680 & 10 \\
\hline
\end{array}
$$
Set up the parameterized equation $y \approx f(x, p)$, assuming the thin-lens formula to be valid: $1 / f=1 / s_1+1 / s_2$, where $s_1$ and $s_2$ are the distances from the lens to the object and the image, respectively. Find the least-squares solution and evaluate the best value for $f$ and its standard inaccuracy. Discuss the validity of the functional fit. Use Python.

Vishal Gupta
Vishal Gupta
Numerade Educator
View

Problem 6

Prove (7.42) by setting $w_i=c / \sigma_i^2$ and eliminating $c$.

Rashmi Sinha
Rashmi Sinha
Numerade Educator
View

Problem 7

The F-test for relevance of a least-squares fit can be used to test if there is a drift in a time series, e.g. a time-dependent variable generated by a simulation that is supposed to produce stationary fluctuating quantities. Generate 100 random numbers from a normal distribution $N(0,1)$. Perform a least-squares fit to $f_i=a i+b$, yielding the best estimates $\hat{a}$ and $\hat{b}$, and compute the standard inaccuracy in $a$. There are two ways to check if the drift you find is significant. First you can assess the probability that $a$ differs from zero, i.e., the two-sided probability that $|a| \leq|\hat{a}|$. Although Student's t-distribution is the appropriate distribution, you can also use a normal distribution because with a large number of degrees of freedom the t-distribution is nearly equivalent to a normal distribution. The second method is using an F-test. Compute SSR and SSE and assess the significance of the linear regression model with an F-test. Do all this for a few fresh series of random samples and compare the two results. In order to get significant results you may add a drift term to the data.

Victor Salazar
Victor Salazar
Numerade Educator