Exercise Set 05
Technical exercise 1: more on logarithmic transformations
Prove that \[\log_b x = \frac{\log_a x}{\log_a b}\] for \(x>0\) and bases \(a>0\), \(b>0\). Start by letting \(y=\log_b x\) and then re-express this as an equation in terms of a power of \(b\). After that, take logarithms of both sides of that equation with respect to a base (figure out which base) and then apply properties of logarithms to derive what needs to be proved.
Refer to the slides on the logarithmic transformations. Given #1 and Technical Exercise 2 of Exercise Set 3, show why the regression slope of
log10NetSales
in the linear regression oflog10TotalComp
onlog10NetSales
is the same as the regression slope oflogNetSales
in the linear regression oflogTotalComp
onlogNetSales
.
Technical exercise 2: a complication with logarithms
Recall from this slide that comparing logarithms of a variable can approximately be thought of as relative changes of that variable on the original scale. Your task is to get a sense of the resulting approximation error.
- Let \(x_1\) and \(x_2\) be the old level and new level of some variable, respectively. Suppose we are considering a comparison between those two levels after a logarithmic transformation, i.e. let \(p=\log x_2-\log x_1\). In other words, the logarithms differ by \(p\). Show that \[\left(e^p-1\right)\times 100\%=\left(\frac{x_2-x_1}{x_1}\right)\times 100\%\] This is an exact value of the relative change.
- In contrast, the slides use an approximation of the form: \[p \times 100\% \approx \left(\frac{x_2-x_1}{x_1}\right)\times 100\%\] Create a table containing the exact and approximate relative changes for different values of \(p\) (from 0 to 1). Discuss the severity of the approximation error, if there is any.
Technical exercise 3: applying the formula for \(\widehat{\beta}\)
Your task is to work on showing what \(\widehat{\beta}\) looks like for the special cases found in the slides.
Start from \[\widehat{\beta}=\left(\frac{1}{n}\sum_{t=1}^n X_tX_t^\prime\right)^{-1}\left(\frac{1}{n}\sum_{t=1}^n X_tY_t\right)\] and work on the two special cases. For the first special case, you should show that \(\widehat{\beta}=\overline{Y}\). For the second special case, you should show that along with Technical Exercise 1 of Exercise Set 2, you will have the formulas found here.
Technical exercise 4: where did the formula for \(\widehat{\beta}\) come from?
You are going to be working out the details of regression with only one regressor with an intercept (really, simple linear regression). Let \(Y_t\) be the \(t\)th observation of the regressand. Recall that lm()
is OLS and that we are minimizing a sum of squared residuals.
Since our regression line for this case is just \(\widehat{Y}_t=\widehat{\beta}_0+\widehat{\beta}_1X_{1t}\), where \(\widehat{\beta}_0\) and \(\widehat{\beta}_1\) need to be determined, you should be able to use what you learned in mathematical economics to minimize \[\sum_{t=1}^n \left(Y_t-\widehat{Y}_t\right)^2=\sum_{t=1}^n \left(Y_t-\widehat{\beta}_0-\widehat{\beta}_1X_{1t}\right)^2 \tag{1}\] with respect to both \(\widehat{\beta}_0\) and \(\widehat{\beta}_1\).
Unlike the solutions to the similar technical exercises from before, expanding would be more complicated. For example, you can use the fact that the derivative of a sum is the sum of the derivatives: \[\frac{d}{d\widehat{\beta}_1} \sum_{t=1}^n \left(Y_t-\widehat{\beta}_1X_{1t}\right)^2 = \sum_{t=1}^n \frac{d}{d\widehat{\beta}_1}\left(Y_t-\widehat{\beta}_1X_{1t}\right)^2=\sum_{t=1}^n 2\left(Y_t-\widehat{\beta}_1X_{1t}\right)\left(-X_{1t}\right)\]
Show that the two first-order conditions for finding the optimal values of \(\widehat{\beta}_0\) and \(\widehat{\beta}_1\) are given by: \[\begin{eqnarray} \sum_{t=1}^n \left(Y_t-\widehat{\beta}_0-\widehat{\beta}_1X_{1t}\right) &=& 0 \\ \sum_{t=1}^n X_{1t}\left(Y_t-\widehat{\beta}_0-\widehat{\beta}_1X_{1t}\right) &=& 0 \end{eqnarray}\]
Show that you can rewrite these two equations \[\begin{eqnarray} \sum_{t=1}^n Y_t &=& n\widehat{\beta}_0 + \widehat{\beta}_1 \sum_{t=1}^n X_{1t} \\ \sum_{t=1}^n X_{1t}Y_t &=& \widehat{\beta}_0\sum_{t=1}^n X_{1t}+ \widehat{\beta}_1 \sum_{t=1}^n X_{1t}^2 \end{eqnarray}\]
Next, show that you can express these two equations in matrix form by putting in the appropriate entries into the entries marked by question marks: \[\begin{eqnarray}\begin{pmatrix}\ ? & \ ? \\ \ ? & \ ?\end{pmatrix} \begin{pmatrix} \widehat{\beta}_0 \\ \widehat{\beta}_1 \end{pmatrix}= \begin{pmatrix}\ ?\\ \ ? \end{pmatrix}\end{eqnarray}\]
Use what you have seen so far in this exercise to show that
- the mean of the residuals has to be zero.
- the correlation coefficient between the regressor \(X_{1}\) and the residuals is zero.
- the mean of the actual values of \(Y\) is equal to the mean of the fitted values.
What you will be expected to do
You will be submitting to my email a zip file (not rar, not 7z) with filename surname_exset05.zip
, replacing surname
with your actual surname, and making sure it contains
- Scanned PDF solutions to the technical exercises (do be mindful of the size of the file, keep under 15 MB if possible) with filename
surname_tech05.pdf
- Your qmd file with filename
surname_exset05.qmd
and - The HTML file associated with your qmd file.