DESCRIPTION Students: Please keep in mind the OMSI rules. Save your files often, make sure OMSI fills your entire screen at all times, etc. Remember that clicking CopyQtoA will copy the entire question box to the answer box. In questions involving code which will PARTIALLY be given to you in the question specs, you may need add new lines. There may not be information given as to where the lines should be inserted. MAKE SURE TO RUN THE CODE IN PROBLEMS THAT INVOLVE CODE! QUESTION (Text answer, 25 points.) In the past, it had always been thought that the graph of MAPE or MSPE would be U-shaped, but recently it has been observed that two U-shaped curve segments may occur. What is the name of this phenomenon? QUESTION (Text answer, 25 points) Suppose the pair (X,Y) is uniformly distributed on a certain 2-dimensional geometric figure. Possible figures are square, rectangle, diamond, triangle, circle, and ellipse, with the following properties: * the square has corners (1,-1), (1,1), (-1,1), (-1,-1) * the rectangle has corners (1,0), (1,1), (-1,1), (-1,0) * the diamond has corners (1,0), (0,1), (-1,0), (0,-1) * the major and minor axes of the ellipse are parallel to the horizontal and vertical axes, respectively, and have lengths 3 and 2, respectively, and the ellipse's center is at (0,0) * the triangle has corners at (-1,0), (1,0) and (0,1). For each figure state whether X and Y will be uncorrelated, and whether X and Y will be independent. Your answer MUST in the following format, stating which figures have uncorrelated (X,Y) and which have independent (X,Y). For instance, if you think the ellipse and triangle give 0 correlation, while the square, rectangle, triangle and circle give independence, answer this way: 0 correlation: ellipse, triangle independence: square, rectangle, triangle and circle QUESTION -ext .R -run 'Rscript ./omsi_answer3.R' (R code answer, 25 points) One of the problems with polynomial regression is that the various powers of a feature become highly correlated with each other. The code below is intended to illustrate this. Fill in the blanks. polycorr <- function(x,deg) # look at powers 2,3,...,deg { d <- matrix(x,ncol=1) for ( ) { d <- cbind( ) crr <- cor(d) crr <- crr[row(crr) != col(crr)] # trick to get nondiag elements print(max(crr)) print(min(crr)) } } library(regtools) data(mlb) polycorr(mlb$Age,6) QUESTION -ext .R -run 'Rscript ./omsi_answer4.R' (R code answer, 25 points.) The R built-in function eigen() finds eigenvalues and eigenvectors of a matrix, storing them in the components $values and $vectors, respectively. In the latter, each eigenvector is in one column. Write your own "homegrown" alternative to prcomp(), myPCA(data), which will return an R list with components $sdev and $rotation, as with prcomp(). myPCA <- function(x) { } library(regtools) data(mlb) mlbx <- mlb[,c('Height','Weight','Age')] myPCA(mlbx) pcout <- prcomp(mlbx) pcout$sdev pcout$rotation