Answered step by step
Verified Expert Solution
Question
1 Approved Answer
By using Matlab: Longley data set. The Longley data set of labor statistics was one of the first used to test the accuracy of least
By using Matlab: Longley data set. The Longley data set of labor statistics was one of the first used to test the accuracy of least squares computations. You don't need to go to the NIST Web site to do this problem, but if you are interested in the background, you should see the Longley page at . The data set is available in NCM in the file longley.dat. You can bring the data into MATLAB with load longley.dat y longley(:,1) There are 16 observations of 7 variables, gathered over the years 1947 to 1962. The variable y and the 6 variables making up the columns of the data matrix are y = Total Derived Employ!nent. = GNP Implicit Price Deflater x2 Gross National Product, r3Unemployment, T4 = Size of Armed Forces, rs Noninstitutional Population Age 14 and Over, Zg=Year The objective is to predict y by a linear combination of a constant and the six r's: (a) Use the MATLAB backslash operator to compute A-a, ,As. This involves augmenting X with a column of all 1's, corresponding to the constant term. (b) Compare your 's with the certified values [3] (c) Use errorbar to plot y with error bars whose magnitude is the difference between y and the least squares fit. (d) Use corrcoef to compute the correlation coefficients for X without the column of 1's. Which variables are highly correlated? (e) Normalize the vector y so that its mean is zero and its standard deviation is one. You can do this with -mean(y); y/std(y) y = y y Do the same thing to the columns of X. Now plot all seven normalized vari- ables on the same axis. Include a legend By using Matlab: Longley data set. The Longley data set of labor statistics was one of the first used to test the accuracy of least squares computations. You don't need to go to the NIST Web site to do this problem, but if you are interested in the background, you should see the Longley page at . The data set is available in NCM in the file longley.dat. You can bring the data into MATLAB with load longley.dat y longley(:,1) There are 16 observations of 7 variables, gathered over the years 1947 to 1962. The variable y and the 6 variables making up the columns of the data matrix are y = Total Derived Employ!nent. = GNP Implicit Price Deflater x2 Gross National Product, r3Unemployment, T4 = Size of Armed Forces, rs Noninstitutional Population Age 14 and Over, Zg=Year The objective is to predict y by a linear combination of a constant and the six r's: (a) Use the MATLAB backslash operator to compute A-a, ,As. This involves augmenting X with a column of all 1's, corresponding to the constant term. (b) Compare your 's with the certified values [3] (c) Use errorbar to plot y with error bars whose magnitude is the difference between y and the least squares fit. (d) Use corrcoef to compute the correlation coefficients for X without the column of 1's. Which variables are highly correlated? (e) Normalize the vector y so that its mean is zero and its standard deviation is one. You can do this with -mean(y); y/std(y) y = y y Do the same thing to the columns of X. Now plot all seven normalized vari- ables on the same axis. Include a legend
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started