Country : Australia
Machine Learning and Big Data for Economics and Finance - Computer Science Assessment Answer
Task:

Exercise 1. Nonlinear regression learning exercise Consider the model

Y = e
X + "; where
= 0.6, X, Y and " are three random variables such that X  N(0; 1), " N(0; 1) and
X and " are independent of each other. 1. Write R code to generate a sample of size n = 1000 from this model. Print summary
statitics of the variables generated. 2. Assuming now that one only observes X and Y in that sample, let us conduct the
supervised learning exercise where the objective is to predict Y given X. Try to learn the function f in Y  f(X) by the three dierent models  Linear regression.  Quadratic regression.  Cubic regression. For each of the three models, a. Write R code. b. Show R output. c. Plot the residuals and discuss the residual plots. d. Plot on a single gure the data and the in-sample predicted values for all three models. 3. Assuming again that one only observes X and Y in that sample, let us further assume that we know that f takes the functional form f(x) = e
x. We will try to obtain an estimate for

by minimizing the sum of the squares of the residulas

Q(b) =X
i=1
n
(yi ¡ e

bxi)2 where xi and yi are obviously the points in the sample. a. Plot Q for b taking values on a grid of points of size 100 in the interval [¡1.5; 1.5]. b. Deduce an estimate
^. c. Plot a gure showing the in-sample predicted values vs. the actual data. d. Would it have been possible to estimate this model using the lm() function in R?
4. In this last question, we will compare the t for all 4 models (linear, quadratic, cubic
and actual model). a. Compute the training mean squared error for all four models. b. Generate a new sample of size m = 100 from the true model and compute the test MSE for all four models using that new sample. c. Based on the results, which model do you choose? Discuss. Exercise 2. Consider the following sample of the three random variables X1, X2 and Y :

Obs. X1 X2 Y
1 1 2 0
2 1 3 0
3 -3 1 0
4 2 2 1
5 3 2 1
6 4 1 1
7 4 3 1

Table 1. 1. Enter the data into R. 2. Given an input of the form (a; b), write an R function predicty(a,b) that outputs a prediction of PrfY = 1jX1 = a; X2 = bg based on 1-nearest neighbor classication and
based on the training sample in the table. Test your function on 3 random points. Notes: These are some helpful additional hints.  An R function sum2 that takes two inputs u and v and return their sum could be written as follows
sum2 = function(u,v)
{
s = u + v
return(s)
}
and then could be used in the console by simply typing sum2(3,4) in order to add 3 and 4.  The R function seq is useful for generating a sequence (list) of numbers.

This Computer Science Assessment has been solved by our IT/Computer Science experts at UniLearnO. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
 

  • Uploaded By : jaxon
  • Posted on : August 27th, 2018
  • Downloads : 169

Whatsapp Tap to ChatGet instant assistance