# Quiz 10: More complex questions¶

If you wish, you can do a self grading version of the quiz below. In order to open the interactive version of the notebook, you need to open it in Binder. To do this, hover your mouse over the rocket symbol (near the top right of the page) and click on the word “Binder” which should appear. This will load an interactive quiz. The first time you load this it may take a few minutes.

## Quiz¶

This quiz tests materials in the section called “Discrete random variables”. If you are struggling with the questions go back and re-read the relevant material.

### More complex differentiation¶

**Question 1**: Calculate \(\frac{d}{dx} log(x^2)\)

Choose the correct answer:

\(\frac{2x}{log(x^2)}\)

\(2 x^{-2}\)

\(2 x^{-1}\)

\(2 log(x^2)\)

**Question 2**: Calculate \(\frac{d}{dx} x log(x)\)

Choose the correct answer:

\(1 + log(x)\)

\(\frac{x}{log(x)}\)

\(log(x)+x\)

\(log(x^2)\)

**Question 3**: Calculate \(\frac{d}{dx} \frac{x}{log(x)}\)

Choose the correct answer:

\(-\frac{x}{(log(x))^2}\)

\(\frac{1}{(x log(x))^2}\)

\(\frac{log(x) (1 - log(x))}{x^2}\)

\(\frac{1}{log(x)} - \frac{1}{(log(x))^2}\)

**Question 4**: Calculate \(\frac{d}{d\beta} \sum_{i=1}^n log(\beta x_i + 2 x+i^2)\)

Choose the correct answer:

\(\frac{1}{\sum_{i=1}^n \beta x_i + 2 x+i^2}\)

\(\sum_{i=1}^n \frac{x_i}{\beta x_i + 2 x+i^2}\)

\(\sum_{i=1}^n \frac{x_i}{log(\beta x_i + 2 x+i^2)}\)

\(\frac{x_i}{\beta x_i + 2 x+i^2}\)

**Question 5**: Calculate \(\frac{d}{d\sigma} \sigma log(\sigma^2)\)

Choose the correct answer:

\(2 + log(\sigma^2)\)

\(\frac{\sigma}{log(\sigma^2)} + \sigma log(\sigma^2)\)

\(log(\sigma^2)\)

\(log(\sigma^2) + \frac{2\sigma}{log(\sigma^2)}\)

**Question 6**: Calculate \(\frac{d}{d\theta} \frac{\theta}{1 + e^\theta}\)

Choose the correct answer:

\(\frac{1}{1 + e^\theta}\left( 1 - \frac{1}{1 + e^\theta}\right)\)

\(\frac{1}{1 + e^\theta}\times \frac{e^\theta}{1 + e^\theta}\)

\(\frac{1}{1 + e^\theta} - \frac{\theta e^\theta}{(1 + e^\theta)^2}\)

\(\frac{e^\theta}{1 + e^\theta} - \frac{\theta e^\theta}{1 + e^\theta}\)

### More complex integration¶

**Question 7**: Calculate \(\int \frac{2x + 3}{x^2 + 3x - 5} dx\)

Choose the correct answer:

\(log(x^2 + 3x - 5) + c\)

\(\frac{1}{x^2 + 3x - 5} + c\)

\(\frac{log(x^2 + 3x - 5)}{x^2 + 3x - 5} + c\)

\(\frac{2x^3 + 3x}{x^2 + 3x - 5} + c\)

Note that \(c\) is the constant of integration.

**Question 8**: Calculate \(\int \frac{ln(x)}{x} dx\)

Choose the correct answer:

\(\frac{x}{ln(x)} + c\)

\(\frac{1}{2} ln(x)^2 + c\)

\(\frac{ln(x)^2}{x} + c\)

\(\frac{1}{x ln(x)} + c\)

**Question 9**: Calculate \(\int x^2 e^{3x} dx\)

Choose the correct answer:

\(e^{3x} (x^3 + 2 x^2 + x) + c\)

\(\frac{e^{3x}}{9}(x^2 -2 x + \frac{1}{3}) + c\)

\(e^{3x} (x^2 + \frac{2}{3} x + \frac{2}{3}) + c\)

\(\frac{e^{3x}}{3}(x^2 - \frac{2}{3} x + \frac{2}{9}) + c\)

**Question 10**: Calculate \(\int_0^1 x \alpha x^{\alpha-1} dx\)

Choose the correct answer:

\(\alpha\)

\(\frac{\alpha}{\alpha + 1}\)

\(\frac{\alpha}{\alpha - 1}\)

\(\frac{\alpha(1-\alpha)}{\alpha^2}\)

Note there is no constant of integration. Why?

**Question 11**: Calculate \(\int_0^\infty t \lambda e^{-\lambda t} dt\)

Choose the correct answer:

\(e^{-\lambda}\)

\(\lambda\)

\(\frac{e^{-\lambda}}{\lambda}\)

\(\frac{1}{\lambda}\)

### Logarithms¶

**Question 12**: The geometric mean is defined as follows:

Suppose we have data \(y_1\), \(y_2\), …, \(y_n\), and we know that \(y_i = ln(x_i)\).

Write the arithmetic mean of the data, \(\bar{y}\), in terms of \(\tilde{x}\).

Choose the correct answer:

\(\bar{y} = \tilde{x}\)

\(\bar{y} = e^\tilde{x}\)

\(\bar{y} = log(\tilde{x})\)

\(e^\bar{y} = e^\tilde{x}\)

**Question 13**: Suppose that \(y(x) = a + b x\). Then \(y(x+1) - y(x) = b\). In other words, \(b\) is the change in \(y\) for a unit increase in \(x\).

What can we say about \(b\) when \(log( y(x) )= a + b x\)?

Choose one:

\(b\) is the multiplicative increase in \(y\) for a unit increase in \(x\)

\(e^b\) is the multiplicative increase in \(y\) for a unit increase in \(x\)

\(b\) is the additive increase in \(y\) for a unit increase in \(x\)

\(2^b\) is the additive increase in \(y\) for a unit increase in \(x\)

## Putting it all together: Finding a maximum likelihood estimator¶

**Question 14**: You will learn the theory behind this method later. For now, we will undertake the mechanics of the calculation.

We have observed data points \(x_1, x_2, ..., x_n\), which are realisations from distributions \(X_1, X_2, ...X_n\), where each \(X_i \sim N(5, \sigma^2)\).

We are going to find the maximum likelihood estimate for \(\sigma^2\). During the calculations, keep everything in terms of \(\sigma^2\), not \(\sigma\). If you have problems doing this, you can always substitute \(u=\sigma^2\), and substitute back at the end.

The likelihood for the data is:

Using the skills you have been re-learning in this book, your task is to find the value of \(\sigma^2\) which maximises this likelihood.

Hints:

Take the natural log to get the log-likelihood, \(l(\sigma^2) = L(\sigma^2)\)

Differentiate the log-likelihood with respect to \(\sigma^2\)

Solve \(l'(\sigma^2) = 0\) to find the maximum.

What is the maximum likelihood estimate for \(\sigma^2\)?

\(\hat{\sigma}^2 = \frac{1}{n}\sum_{i=1}^n \frac{(x_i - 5)}{\sqrt{2 \pi}}\)

\(\hat{\sigma}^2 = \frac{1}{\sqrt{2 \pi n}}\sum_{i=1}^n (x_i - 5)^2\)

\(\hat{\sigma}^2 = \frac{1}{n}\sum_{i=1}^n (x_i - 5)^2\)

\(\hat{\sigma}^2 = (\bar{x} - 5)^2\)