Google Stuff Carleton. US Open NHL66 | NHL Streams M Gmail b=(sumxx sumxy - sumxxx sumy)+...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Google Stuff Carleton. US Open NHL66 | NHL Streams M Gmail b=(sumxx sumxy - sumxxx sumy)+ (sumxx sumx-nx sumxx) where: Page 1 YouTube sumx is xo + x1 + x₂ + ... + xn-1; i.e., the sum of all the x values sumy is yo + y + y2 + ... +yn-1; i.e., the sum of all the y values sumxx is x² + x₁² + x2²2+...+x-1²; i.e., the sum of all the squares of the x values sumxy is xox yo+x1x y₁ + x2 x y2 + ... +X-1 xy-1; i.e., the sum of all the products of the (x, y) pairs y=3.0x +2.0. To ensure that you understand these formulas, use the method of least squares to calculate the slope and y-intercept of the line through this set of points: {(1.0, 5.0), (2.0, 8.0), (3.5, 12.5)). Don't write a program to do this; use a calculator. If your calculations are correct, the equation of the line will be: Exercise 2 Download linear_regression.py from cuLearn and open the file in Wing 101. This file contains a function named get_points, which returns this set of three points: {(1.0, 5.0), (2.0, 8.0), (3.5, 12.5)). Read the docstring, then type these statements in the shell. >>> samples = get_points() >>> len (samples) # How many tuples (points) are in the set? >>> samples Exercise 3 Use the function design recipe from Chapter 3 of Practical Programming to develop a function 4 Bi Review your solutions to Lab 11 before you start this lab. Information about tuples and sets can be found in these sections from Practical Programming, 3rd Edition, Chapter 11: Storing Data Using Sets (pages 203 - 209) • Storing Data Using Tuples (pages 209-214) Getting Started Begin by creating a new file within Wing 101. Save it as lab12.py Part 1 - Introduction to the Method of Least Squares Exercise 1 Every engineering student has tackled the problem of fitting a line through a set of points obtained during a lab experiment. Linear regression is a technique for fitting a curve through a set of points by applying a goodness-of-fit criterion. The most common form of linear regression is least-squares fitting. The mathematical derivation of this technique is beyond the scope of this course, but if you're interested, you can read this page: http://mathworld.wolfram.com/LeastSquaresFitting.html Suppose we have a set of n points, {(xo, yo), (X₁, Y₁), ... (Xn-1, -1)}. The equation of a straight line through these points has the form y=mx+b, where m is the slope of the line and b is the y- intercept. Using the method of least squares, the slope m and y-intercept b of the line with the best fit are calculated this way: m=(sumxx sumy - nx sumxy) + (sumx × sumxnx sumxx) b- (sumxx sumxy-sumxxx sumy)+(sumxx sumx-nx sumxx) where: O Et F4 F5 Page 1 1 F6 ķ F7 PrtScn FB Home RP F9 oints() >>> len (samples) # How many tuples (points) are in the set? >>> samples Exercise 3 Use the function design recipe from Chapter 3 of Practical Programming to develop a function in linear regression.py named fit_line_to_points. The function header is: def fit_line_to_points (points: Set [Tuple [float, float]]) -> Tuple [float, float] The type annotation specifies that this function is passed a set of tuples, with each tuple representing one (x, y) point. The function returns a tuple, which contains the slope and intercept of the best-fit straight line through the points. The function body must use the method of least squares described in Exercise 1. In addition to coding the function's body, remember to write a docstring example that shows how the function can be tested from the Python shell. Use the shell to call fit_line_to_points, passing it the set returned by get_points. Verify that the slope and y-intercept returned by the function are 3.0 and 2.0. Page 2 Google Stuff Carleton. US Open NHL66 | NHL Streams M Gmail b=(sumxx sumxy - sumxxx sumy)+ (sumxx sumx-nx sumxx) where: Page 1 YouTube sumx is xo + x1 + x₂ + ... + xn-1; i.e., the sum of all the x values sumy is yo + y + y2 + ... +yn-1; i.e., the sum of all the y values sumxx is x² + x₁² + x2²2+...+x-1²; i.e., the sum of all the squares of the x values sumxy is xox yo+x1x y₁ + x2 x y2 + ... +X-1 xy-1; i.e., the sum of all the products of the (x, y) pairs y=3.0x +2.0. To ensure that you understand these formulas, use the method of least squares to calculate the slope and y-intercept of the line through this set of points: {(1.0, 5.0), (2.0, 8.0), (3.5, 12.5)). Don't write a program to do this; use a calculator. If your calculations are correct, the equation of the line will be: Exercise 2 Download linear_regression.py from cuLearn and open the file in Wing 101. This file contains a function named get_points, which returns this set of three points: {(1.0, 5.0), (2.0, 8.0), (3.5, 12.5)). Read the docstring, then type these statements in the shell. >>> samples = get_points() >>> len (samples) # How many tuples (points) are in the set? >>> samples Exercise 3 Use the function design recipe from Chapter 3 of Practical Programming to develop a function 4 Bi Review your solutions to Lab 11 before you start this lab. Information about tuples and sets can be found in these sections from Practical Programming, 3rd Edition, Chapter 11: Storing Data Using Sets (pages 203 - 209) • Storing Data Using Tuples (pages 209-214) Getting Started Begin by creating a new file within Wing 101. Save it as lab12.py Part 1 - Introduction to the Method of Least Squares Exercise 1 Every engineering student has tackled the problem of fitting a line through a set of points obtained during a lab experiment. Linear regression is a technique for fitting a curve through a set of points by applying a goodness-of-fit criterion. The most common form of linear regression is least-squares fitting. The mathematical derivation of this technique is beyond the scope of this course, but if you're interested, you can read this page: http://mathworld.wolfram.com/LeastSquaresFitting.html Suppose we have a set of n points, {(xo, yo), (X₁, Y₁), ... (Xn-1, -1)}. The equation of a straight line through these points has the form y=mx+b, where m is the slope of the line and b is the y- intercept. Using the method of least squares, the slope m and y-intercept b of the line with the best fit are calculated this way: m=(sumxx sumy - nx sumxy) + (sumx × sumxnx sumxx) b- (sumxx sumxy-sumxxx sumy)+(sumxx sumx-nx sumxx) where: O Et F4 F5 Page 1 1 F6 ķ F7 PrtScn FB Home RP F9 oints() >>> len (samples) # How many tuples (points) are in the set? >>> samples Exercise 3 Use the function design recipe from Chapter 3 of Practical Programming to develop a function in linear regression.py named fit_line_to_points. The function header is: def fit_line_to_points (points: Set [Tuple [float, float]]) -> Tuple [float, float] The type annotation specifies that this function is passed a set of tuples, with each tuple representing one (x, y) point. The function returns a tuple, which contains the slope and intercept of the best-fit straight line through the points. The function body must use the method of least squares described in Exercise 1. In addition to coding the function's body, remember to write a docstring example that shows how the function can be tested from the Python shell. Use the shell to call fit_line_to_points, passing it the set returned by get_points. Verify that the slope and y-intercept returned by the function are 3.0 and 2.0. Page 2
Expert Answer:
Answer rating: 100% (QA)
It appears that you are trying to find the slope m and yintercept b of the bestfit line for a set of ... View the full answer
Related Book For
Posted Date:
Students also viewed these electrical engineering questions
-
The three-digit number is given. The sum of all different three-digit numbers with the same digits as the given number (including the given number) is 1998. How many different three-digit numbers...
-
The sum of all the values in the data set divided by the number of values in the data set Is the:
-
The sum of all the digits that appear in the (IUPAC) name for this compound is which of the following? (a) Five (b) Six (c) Seven (d) Eight (e) Nine CH C CH2 -CHCH CH CH2CH2CHCH2CH2CH2CH
-
You are given the equation(s) used to solve a problem. For each of these, you are to a. Write a realistic problem for which this is the correct equation(s). b. Finish the solution of the problem.
-
What is the difference between a target zone and a crawling peg?
-
Listed below are ten items that may be found on a balance sheet. Required: Indicate with yes or no whether each of the items should be included in the cash balance presented on the balance sheet....
-
IDEC Pharmaceuticals is considering a drug project that costs \($100,000\) today and is expected to generate end-of-year annual cash flow of \($50,000\) forever. At what discount rate would IDEC be...
-
Josh Smith has compiled some of his personal financial data in order to determine his liquidity position. The data are as follows. Account Amount Cash ............ $3,200 Marketable securities .........
-
Tolo Co. plans the following? repurchases: $10.4 million in one?year, nothing in two? years, and $20.5 million in three years.After? that, it will stop repurchasing and will issue dividends 2 answers
-
Forrest runs Y Not Flowers, Inc. (YNF), a wholesale flower distributor with stores in several major metropolitan areas of the U.S. He is considering expanding his business, but he thinks his current...
-
Collyer Ltd has a valve division that manufactures and sells a standard valve as follows: Capacity in units Selling price to outside customers on intermediate market Variable costs per unit Fixed...
-
The structure of a firm using this production technology is often tall and thin, or even an inverted pyramid. You decide to group employees based on what they know. What basis of grouping employees...
-
Which aspect of environment law makes it uniquely hard to sue for environmental harm? 1. It is often hard to find a plaintiff willing to sue for environmental damage 2. It is uncommon for entities to...
-
From your dataset calculate return on assets (ROA) for each year, with a trend analysis, and comment on the firm performance. Also use graph to explain (ROA). From your dataset calculate return on...
-
Choi Company manufactures two skin care lotions, Smooth Skin and Silken Skin, from a joint process. The joint costs incurred are $430,000 for a standard production run that generates 200,000 pints of...
-
Write a program in Assembly language using MIPS instruction set to read three integer numbers from user and find out the largest among all the numbers. Consider the following C program to understand...
-
Jack, an 8-year-old White male, was referred to the local guidance clinic by his physician. He has a history of school problems and poor social relations, and he has struggled with an illness in his...
-
Write out the formula for the total costs of carrying and ordering inventory, and then use the formula to derive the EOQ model. Andria Mullins, financial manager of Webster Electronics, has been...
-
Indicate whether the following terms or symbols are associated with the population mean, the sample mean, or both means. (a) N (b) Varies (c) S (d) N (e) Constant (f) Subset
-
Indicate whether the following generalizations suggest a positive or negative relationship. Also speculate about whether or not these generalizations reflect simple cause- effect relationships. (a)...
-
Does the type of instruction in a college sociology class (either lecture or self- paced) and its grading policy (either letter or pass/ fail) influence the performance of students, as measured by...
-
Are the GAAS audit standards designed to catch fraud other than financial statement fraud? What is the expectation gap? Did SAS No. 99 close it?
-
Define these terms: a. Materiality b. Control risk c. Inherent risk d. Detection risk
-
What two fieldwork stages gather audit evidence?
Study smarter with the SolutionInn App