9.5 Exercises

Exercise 9.1 Algebraically solve the equation \(\displaystyle 0.45 = \frac{K}{1+e^{a}}\) for \(K\).

 

Exercise 9.2 Evaluate \(\displaystyle \int_{0}^{5} 2 e^{-2x} \; dx\) by hand. Then use R to compute the value of \(\displaystyle \int_{0}^{5} 2 e^{-2x} \; dx\). Does your computed answer match with what you found in R?

 

Exercise 9.3 Make a plot of the normal density distribution with \(\mu=2\) and \(\sigma=0.1\) for \(0 \leq x \leq 4\). Then use R to compute the following integral: \(\displaystyle \int_{0}^{4} f(x) \; dx\), where \(f(x)\) is the normal density function.

 

Exercise 9.4 Visualize the likelihood function for the yeast dataset, but in this case report out and visualize the loglikelihood. (This means that you are setting the option logLikely = TRUE in the compute_likelihood function.) Compare the loglikelihood surface to Figure 9.12.

 

Exercise 9.5 When we generated our plot of the likelihood function in Figure 9.9 we assumed that \(\sigma=1\) in Equation (9.1). For this exercise you will explore what happens in Equation (9.1) as \(\sigma\) increases or decreases.

  1. Use desmos to generate a plot of Equation (9.1), but let \(\sigma\) be a slider. What happens to the shape of the likelihood function as \(\sigma\) increases?
  2. How does the estimate of \(b\) change as \(\sigma\) changes?
  3. The spread of the distribution (in terms of it being more peaked or less peaked)is a measure of uncertainty of a parameter estimate. How does the resulting parameter uncertainty change as \(\sigma\) changes?

 

Exercise 9.6 Using Equation (9.1) with \(\sigma = 1\):

  1. Apply the natural logarithm to both sides of this expression.
  2. Using properties of logarithms, show that the loglikelihood function \(\ln(L(b)) =-2 \ln(2) - 2 \ln (\pi) -(3-b)^{2}-(5-2b)^{2}-(4-4b)^{2}-(10-4b)^{2}\). Make a plot of the log likelihood function (in desmos or R). Where is this function optimized? Is it a maximum or a minimum value?
  3. Compare this likelihood estimate for \(b\) to what was found in Figure 9.9.

 

Exercise 9.7 Consider the linear model \(y=a+bx\) for the following dataset:

x y
1 3
2 5
4 4
4 10
  1. With the function compute_likelihood, generate a contour plot of both the likelihood and log-likelihood functions.
  2. Make a scatterplot of these data with the equation \(y=a+bx\) with your maximum likelihood parameter estimates.
  3. Earlier when we fit \(y=bx\) we found \(b=1.86\). How does adding \(a\) as a model parameter affect your estimate of \(b\)?

 

Exercise 9.8 For the function \(\displaystyle P(t)=\frac{K}{1+e^{a+bt}}\), with \(P(0)=P_{0}\), determine an expression for the parameter \(a\) in terms of \(K\), \(b\), and \(P_{0}\).

 

Exercise 9.9 The values returned by the maximum likelihood estimate for Equation (9.3) were a little different from those reported in Gause (1932):

Parameter Maximum Likelihood Estimate Gause (1932)
\(K\) 12.7 13.0
\(b\) 0.24242 0.21827
Make of plot of the function \(\displaystyle y = \frac{K}{1+e^{a-bt}}\) with \(\displaystyle a = \ln \left( \frac{K}{0.45} - 1 \right)\) for both parameter values, along with the yeast data. to generate plots with the yeast data with the curves with parameters from both the Maximum Likelihood estimate and from Gause (1932). Which approach does a better job representing the data?

 

Exercise 9.10 An equation that relates a consumer’s nutrient content (denoted as \(y\)) to the nutrient content of food (denoted as \(x\)) is given by: \(\displaystyle y = c x^{1/\theta}\), where \(\theta \geq 1\) and \(c\) are both constants.

  1. Use the dataset phosphrous make a scatter plot with the variable algae on the horizontal axis, daphnia on the vertical axis.
  2. Generate a contour plot for the likelihood function for these data. You may assume \(1 \leq \theta \leq 20\) and \(0 \leq c \leq 5\). What are the values of \(\theta\) and \(c\) that optimize the likelihood? Hint: for the dataset phosphorous be sure to use the variables \(x=\)algae and \(y=\)daphnia.
  3. With your values of \(c\) and \(\theta\) add the function \(W\) to your scatterplot and compare the fitted curve to the data.

 

Exercise 9.11 A dog’s weight \(W\) (pounds) changes over \(D\) days according to the following function: \[\begin{equation} W =f(D,p_{1},p_{2})= \frac{p_{1}}{1+e^{2.462-p_{2}D}} \end{equation}\] where we have the parameters \(p_{1}\) and \(p_{2}\). The dataset wilson shows how the weight of a dog named Wilson (adapted from here).

  1. Make a scatterplot with the wilson data. What is the long term weight of the dog?
  2. Generate a contour plot for the likelihood function for these data. What are the values of \(p_{1}\) and \(p_{2}\) that optimize the likelihood? You may assume that \(p_{1}\) and \(p_{2}\) are both positive.
  3. With your values of \(p_{1}\) and \(p_{2}\) add the function \(W\) to your scatterplot and compare the fitted curve to the data.

 

Exercise 9.12 Consider the following data which represents the temperature over the course of a day:

Hour Temperature
0 54
1 53
2 55
3 54
4 58
5 58
6 61
7 63
8 67
9 66
10 67
11 69
12 68
13 68
14 66
15 67
16 63
17 60
18 59
19 57
20 56
21 53
22 52
23 54
24 53

A function that describes these data is \(\displaystyle T = A + B \sin \left( \frac{\pi}{12} \cdot H \right) - C \cos \left( \frac{\pi}{12} \cdot H \right)\), where \(H\) is the hour and \(T\) is the temperature. Use the function compute_likelihood to determine maximum likelihood parameter estimates for \(A\), \(B\), and \(C\). The values of \(A\), \(B\), and \(C\) are all positive.

References

Gause, G. F. 1932. “Experimental Studies on the Struggle for Existence: I. Mixed Population of Two Species of Yeast.” Journal of Experimental Biology 9 (4): 389–402.