KCON G5415 – Advanced Kconometrics, Columbia University, Fall 2020 Problem set # 2.

MATLAB作业代写 Following the provided example and class notes, write the code for the gradient descentmethod and Newton method that…

Problem 1. Consider a system of nonlinear equations: MATLAB作业代写

x2 + y2 = 10

x — 3y = —10

a) Following the provided example and class notes, write the code for the gradient descentmethod and Newton method that computes the solution by reformulating this system as a problem of minimizing the squared sum of residuals. Try out different initial guesses. How many solutions this system has? MATLAB作业代写

b) Look for optimization routines that are available in MATLAB. Solve the system by usingsuch routines by converting this system of equations into a problem of minimizing the squared sum of residuals. Compare the performance of MATLAB software with your code, in particular, the running time.

c) Try to solve this system of equations using the MATLAB solver ”fsolve” without convertingthis problem into an optimization problem.

d) Repeatthe calculations with another system of equations

x2 + y2  =  26

3x2 + 25y2 = 100

Try out different initial guesses. How many solutions this system has? Explain the problems you encounter. MATLAB作业代写

 

Problem 2. We now experiment with the linear regression. Instead of using a fixed actual data set, we will use simulated data which we can adapt to our experiments as needed. Let us draw p random variables of length n from a normal distribution N (0, 1) to produce a matrix of features p × n. Add a column of ones to get Draw  random  errors where .  Given a set of coefficients where ,  let us construct the target (label) variable as y = X8 + o. Let us use 8i, i = 1, …, p that are drawn from a uniform distribution [ 1, 1] and let us assume σ = (p + 1) /10. This leaves us with two free parameters n and p. Thus, given these two parameters, your code must produce y and X. The goal is to estimate the regression coefficients 8.

1)Estimate the regression by using OLS. MATLAB作业代写

2) The gradient descent method.

3) The Newton method.

Write all three methods yourself without relying on the MATLAB routines. Compare the cost of the three methods under different values of n and p.

 

Methods for Solving a System of Nonlinear Equations MATLAB作业代写

MATLAB作业代写
MATLAB作业代写
MATLAB作业代写
MATLAB作业代写

MATLAB作业代写
MATLAB作业代写