### Partially answer 12.1

parent 1f02bb00
 ... ... @@ -47,8 +47,8 @@ int main() { Eigen::MatrixXd mat(n_samples, 2); for (uint32_t i = 0; i < n_samples; ++i) { mat(i, 0) = samples[i]; mat(i, 1) = 1; mat(i, 0) = 1; mat(i, 1) = samples[i]; } // Need at least ThinU and ThinV to use mat_svd.solve. ... ...
 ... ... @@ -2,6 +2,19 @@ title: Problem Set 7 (Function Fitting) --- ## 1 Generate 100 points \$\$x\$\$ uniformly distributed between 0 and 1, and let \$\$y = 2 + 3x + \zeta\$\$, where \$\$\zeta\$\$ is a Gaussian random variable with a standard deviation of 0.5. Use an SVD to fit \$\$y = a + bx\$\$ to this data set, finding \$\$a\$\$ and \$\$b\$\$. Evaluate the errors in \$\$a\$\$ and \$\$b\$\$ using equation (12.34), by bootstrapping to generate 100 datasets, and from fitting an ensemble of 100 independent data sets. I used [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page) to compute the SVD (in C++). My code is [here](https://gitlab.cba.mit.edu/erik/nmm_2020_site/-/tree/master/_code/pset_07/cpp/svd.cpp). I found \$\$a = 2.10697\$\$ and \$\$b = 2.91616\$\$. ## 3 {:.question} ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment