STAT 540 Homework 1 (see NOTES at bottom) Given the following data set: X Y 35.0 13.7 41.8 16.7 42.6 16.4 33.2 9.2 47.2 13.8 53.7 17.8 34.0 19.6 34.3 13.3 42.0 20.8 58.8 15.7 47.3 11.1 37.0 12.6 46.8 12.0 44.6 14.1 29.1 11.3 First, create two vectors in R that hold the X values and the Y values. (For the purposes of this assignment, it's probably easiest to just create the vectors using the c() function.) Then use R to calculate the following things WITHOUT using R's built-in functions to calculate them directly. 1. Calculate the (sample) mean of the values for Y. Print the result to the console. 2. Calculate the (sample) standard deviation of the values for Y. Print the result to the console. 3. Calculate the correlation coefficient between the X values and the Y values. Print the result to the console. 4. Calculate the slope and intercept of the equation of the simple linear regression line for Y regressed on X (i.e., Y as the dependent variable, X as the independent variable). Have R print the slope and intercept to the console. If necessary, you should look up the formulas for these tasks in a resource (such as any introductory statistics book). Again, you may not use the R functions "mean", "sd", "cor" or "lm" which would calculate these directly (except to check your answers). You may use other R functions such as "sum" or "length" in your program. 5. Create a matrix in R that has the X values above as its first column and the Y values above as its second column. Have R print this matrix to the console. 6. From that matrix, create another matrix that consists of the odd-numbered rows of the matrix you just created. Have R print this smaller matrix to the console. NOTE: You MUST intersperse comments (lines that start with #) in your code to explain what your R statements are supposed to be doing. Please be generous with your comments, since you will be graded not only on the correctness of the code, but also on the clarity and amount of comments. NOTE: PLEASE put WITHIN COMMENTS (in lines that start with #) any text (i.e., if you choose to include problem numbers, problem description, your personal comments, output/results) in your file that is not actual R code. This will make it easier and faster to grade. The grader should be able to copy and paste your entire file into R and have it run correctly. NOTE: Submit your solution code by uploading your file in Blackboard. A plain text file (e.g., a .txt file, which you can create with a simple text editor such as Notepad or some similar editor) is best. If using MS Word to create your file, use the "Courier New" font. You can choose "Save As" ... "Plain Text" when saving in Word. If you are typing your HW document on a Mac, please do the following to prevent the formatting from having weird-looking symbols when you upload the file in Blackboard: * First of all, type your program in TextEdit, which is the Mac equivalent of Notepad. * To make it a plain text file, go to the menu "Format" and choose "Make Plain Text".