Homework Problem 4, Due Friday Fri. Sept. 18 -------------------------------------------- (a) Write a function "SimLin" with the following inputs and outputs: INPUTS: xvec = either NULL (the default) or a fixed numeric vector (of arbitrary length) simx = vector of (mean,sd,length) parameters for a normally distributed SIMULATED vector xvec , to be used in case xvec is NULL errsd = error standard deviation to be used in simulating yvec coef = vector with 2 components (intercept,slope) to be used in simulating yvec OUTPUT: a list containing all the (named) components xvec, simx, errsd, coef from the INPUTs, together with a component yvec which is a vector of the same length as xvec , simulated to follow the simple linear regression model yvec[i] = coef[1] + coef[2]*xvec[i] + epsilon[i] where epsilon is a pseudo-random normally distributed vector of the same length as xvec, with mean 0 and standard deviation errsd. (b) Test your function in creating some datasets of moderately large size (say, 300), and show that it is working properly by calculate some appropriate summary statistics (means, covariances, residuals, histograms or whatever: the choice is yours). [The working R lines and outputs for part (b) are restricted to 1/2 page AT MOST. You may, and probably should, submit a few clearly written lines of text to explain what you are calculating and why it indicates that the simulated linear-regression function is working.]