Here's my code and I'm getting an error: length=[22.7, 22.4, 25.8, 21.3, 20.1, 22.1, 21.1, 25.3, 26.9,
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem 6: Calculating Sum of Squared Errors Suppose that a biologist is studying the relationship between the length and weight of yellow-bellied marmots. Based on prior work, she believes that the length and weight of adult marmots can be approximately modeled by a relationship of the following form: weight = 0.6* length - 5.2 To test this model, the biologist collects a sample of 20 adult marmots. The lengths and weights of the marmots are as follows: length = [22.7, 22.4, 25.8, 21.3, 20.1, 22.1, 21.1, 25.3, 26.9, 26.9, 23.0, 23.8, 26.2, 20.4, 23.0, 21.9, 23.5, 27.8, 25.3, 25.9] weight = [9.2, 8.8, 10.7, 8.3, 6.2, 8.6, 7.2, 11.2, 10.5, 11.3, 9.6, 9.9, 10.9, 5.9, 9.5, 9.1, 9.7, 11.6, 10.2, 10.5] Create these lists, as the appear here. You do not need to print anything in this cell. Create a list named pred_weight containing the predicted weight for each marmot, according to the biologist's model. You should begin by creating pred_weight as an empty list. Then loop over the elements of length. Each iteration of the loop should calculate a new predicted weight using the formula provided above, and rounded to 2 decimal places. The round value for each predicted weight should be appended to the list pred_weight. Print pred_weight. The biologist wishes to score her model using the sum of squared errors (SSE) metric. This metric is calculated as follows: 1. For each observation, calculate the difference between the true weight and the predicted weight. 2. Square this difference. 3. Sum the squared differences over all observations Use a for loop to calculate the model's SSE score for this sample of marmots. There are multiple ways to perform this task, but for the sake of efficiency, I would like for you to do it without creating any new lists and using only one loop. Print the value of SSE, rounded to four decimal places. Note that the value stored in SSE should not be rounded, only the value displayed. Problem 6: Calculating Sum of Squared Errors Suppose that a biologist is studying the relationship between the length and weight of yellow-bellied marmots. Based on prior work, she believes that the length and weight of adult marmots can be approximately modeled by a relationship of the following form: weight = 0.6* length - 5.2 To test this model, the biologist collects a sample of 20 adult marmots. The lengths and weights of the marmots are as follows: length = [22.7, 22.4, 25.8, 21.3, 20.1, 22.1, 21.1, 25.3, 26.9, 26.9, 23.0, 23.8, 26.2, 20.4, 23.0, 21.9, 23.5, 27.8, 25.3, 25.9] weight = [9.2, 8.8, 10.7, 8.3, 6.2, 8.6, 7.2, 11.2, 10.5, 11.3, 9.6, 9.9, 10.9, 5.9, 9.5, 9.1, 9.7, 11.6, 10.2, 10.5] Create these lists, as the appear here. You do not need to print anything in this cell. Create a list named pred_weight containing the predicted weight for each marmot, according to the biologist's model. You should begin by creating pred_weight as an empty list. Then loop over the elements of length. Each iteration of the loop should calculate a new predicted weight using the formula provided above, and rounded to 2 decimal places. The round value for each predicted weight should be appended to the list pred_weight. Print pred_weight. The biologist wishes to score her model using the sum of squared errors (SSE) metric. This metric is calculated as follows: 1. For each observation, calculate the difference between the true weight and the predicted weight. 2. Square this difference. 3. Sum the squared differences over all observations Use a for loop to calculate the model's SSE score for this sample of marmots. There are multiple ways to perform this task, but for the sake of efficiency, I would like for you to do it without creating any new lists and using only one loop. Print the value of SSE, rounded to four decimal places. Note that the value stored in SSE should not be rounded, only the value displayed.
Expert Answer:
Related Book For
Applied Statistics And Probability For Engineers
ISBN: 9781118539712
6th Edition
Authors: Douglas C. Montgomery, George C. Runger
Posted Date:
Students also viewed these algorithms questions
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-4. Ivan and Irene paid the following in 2012 (all by check or can otherwise be...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
How do accounting differences impact the usefulness of financial ratio comparisons?
-
1. How do you define psychoactive and addictive drugs? 2. Why are they defined as the most addictive? Is there any one or more of them that the US Government does not seek to limit its use?
-
A uniform rectangular coil of total mass 210 g and dimensions 0.500 m X 1.00 m is oriented perpendicular to a uniform 3.00-T magnetic field (Fig). A current of 2.00 A is suddenly started in the coil....
-
What factors might the Supreme Court take into account in deciding whether to grant a writ of certiorari in a case?
-
Income statements are presented for the Elf Corporation for the years ending December 31, 2010, 2009, and 2008. Required: Write a one-paragraph analysis of Elf Corporation's profit performance for...
-
2. 42. 33 43 A. B. Which of the above atoms belong to inert element R S C. T D. U A. If atom R belong to element R ant atom V belong to element V, what would be the formula of the compound formed...
-
Show that if G is a CFG in Chomsky normal form, then for any string w L(G) of length n 1, exactly 2n 1 steps are required for any derivation of w.
-
The cost (in dollars) of removing p% of the pollutants from the water in a small lake is given by where C is the cost and p is the percent of pollutants. 25,000p C = 100- ' 0 sp < 100
-
You work for a custom travel business that operates across the world. Your clients tend to come from your own country, but you have regular customers from over 40 others. Although you do not offer...
-
What are three techniques for deemphasizing negative news?
-
Should you use the direct or indirect approach for most routine messages? Why?
-
You work for an importexport business that has, until recently, only offered services to other businesses. Recently, you noticed the opportunity to make full use of shipping containers by offering...
-
Imagine that you are the president of the campus business debating and presentation group. You routinely book business professionals who have something interesting or thought-provoking to say. The...
-
On December 1, 2020, Cambridge Printers had the account balances shown below. Debit Credit Cash 14,650 Accumulated DepreciationEquipment 1,500 Accounts Receivable 3,900 Accounts Payable 3,000...
-
Suppose Green Network Energy needs to raise money to finance its new manufacturing facility, but their CFO does not think the company is financially capable of making the periodic interest payments...
-
Wood paneling can be ordered in thicknesses of 1/8, , or 3/8 inch. The random variable is the total thickness of paneling in two orders>
-
An article in the British Medical Journal [Comparison of treatment of renal calculi by operative surgery, percutaneous nephrolithotomy, and extracorporeal shock wave lithotripsy (1986, Vol. 82, pp....
-
Data for tire life was described in Exercise 8-29. The sample standard deviation was 3645.94 kilometers and n = 16. (a) Can you conclude, using = 0.05, that the standard deviation of tire life is...
-
Porter enjoys antique shopping and looking for a good buy. He visited several antique stores and flea markets recently and purchased an old chest of drawers for his extra bedroom. While moving the...
-
Jakari Smith is a new client and has been an investment advice provider as well as an income tax preparer for a well- established firm in the city. He would like to start his own firm as an S...
-
Distinguish between a primary authority and a secondary authority.
Study smarter with the SolutionInn App