Homework 9

Due 2016-11-18 by midnight

  1. Using Rcpp and/or Armadillo, write an importance sampler code to determine the mean of the unscaled distribution f(x) = (2x)^(-x) for x > 0. Use two different envelope functions. Name the C++ file importance.cpp and the R file importance.R
  2. Use Rcpp/Armadillo to write a function that can be used in R that will run a multiple regression model. Have the function return the estimated coefficients, the variance of the estimated coefficients, the sum of squared errors, the R^2, and the F-statistic (basically mirroring the output from R's lm function). Do as much as possible using matrix algebra instead of sums and loops.
  3. Determine the complexity of solving a system of equations as a function of n, the size of the system, using big O notation. What is the complexity of solving a system of equations when the matrix is dense. Determine the complexity when the matrix is upper triangular or lower triangular. Determine the complexity of finding the eigendecomposition of a symmetric matrix.
  4. Submit this homework by committing the necessary files (including any data files) in the appropriate directory and pushing to your central Git repository. Remember to not commit files that are easily reproducible.