Econometric Computing with R

Readings

Table of Contents

Examples

  1. Do you know the accuracy of your computer's numerical calculation? This example addresses this important problem. Suppose e is a known small positive number, and the 5x4 matrix X is defined as follows:

    1  1  1  1
    e  0  0  0
    0  e  0  0
    0  0  e  0
    0  0  0  e
    

    Verify that the eigenvalues of X'X are 4+e2, e2, e2, and e2. How small of the value of e your computer will allow so that X'X can be inverted? (Program).

  2. Write R single-line function to convert quarterly time series into the annual series by taking the average of every four data points. (Program).

  3. Present and solve the following functions:

    1. f(x) = ln(x) - x2
      Hint: The maximal of f(x) is found at x = Ö½ or 0.707. (Program).

    2. g(x) = (x12 + x2 - 11)2 + (x1 + x22 -7)2
      Hint: There are four minima: (3, 2), (3.5844, -1.8481), (-3.7793, -3.2832), (-2.8051, 3.1313). (Program).