Calculate the equation of this best fit straight line

Assignment Help Basic Computer Science
Reference no: EM13861887

Linear regression is a method for calculating the equation of the "best" straight line that passes through a set of points. By "best," we mean the "best fit" straight line—the one that passes as closely as possible to as many points as possible. To calculate the equation of this best fit straight line, you begin with a set of N data points, y;), for i = 0,1, 2, 3....., N — 1. You then calculate: Sum of Sum of 

Sum of squares of 

Yi Sum of products of x,y,: sP-1 

E"n E x‘Y‘ The equation of the "best fit" straight line b will then have slope m given by 

And y-intercept b as: 

b= 

M = 

— 

(Y-)(.')-(")(2 xtYll N — x,) 

However, a linear regression is only as good as its fit. While it is not the best goodness-of-fit test for a linear regression, the le value is commonly accepted as a decent enough indicator of how well a line fits the data it is supposed to represent. Commonly, an le value of .9 or higher is considered a good fit. Anything below .6 is considered inconsequential, and anything in between ranks from mediocre to decent. The le value can be calculated as shown below. 

where, y 

The difference between )7 (the value or y as estimated by the line) and y (the original data value) should be noted. 

Your program should: 

• Read two sets of data from a file (11W7dateMB and store them as arrays of length 20. The data is presented as x y form (on each line there will be a value for and a value for y) where isod  an integer and y is a float value. Continue reading the file and allocating the data into two arrays. The data file is located in the Documents section on Blackboard. • Find the estimated slope, m. • Find the estimated intercept, b. • Find the 12' value for the line created using the previously found estimated slope and intercept. • Output the equation of the line as well as Melt.' value onto thc screen. 

Notes: 

• Ideally the user should ace very little on the screen and have no input at all. • You will probably need more than the two originally defined arrays. However, recognize that SUMS and meant are only net value and therefore do not need to be stored as arrays. • It may help to break up calculations into numerators and denominators as well • To read the values from HW7datamt, use the following code fragment. 

int x[20]; float y[20]; FILE app; fp = fopen("HW7datuter,Y); for(i=0; i<20; t-m) 

MeauF(FIVYul %Di 804ili &Yli1); //Reads new linc from Elk every time the Rop executes 

Reference no: EM13861887

Questions Cloud

What is the companys magnitude of operating leverage : What is this company's magnitude of operating leverage? (Do not round intermediate calculations. Round your final answer to 2 decimal places.)
Explain what the value of the standard error : Explain what the value of the standard error of the mean indicates about the true value of the measurement if it is assumed that the variation is due only to random variation
It budget on security : What you need to convey to your CEO is that network attacks are continuing to make the news and organizations have reacted by increasingly spending more of their overall IT budget on security. Business executives are starting to have questions about ..
What is totals interest expense for swiss franc debt : What is Totals net Swiss franc cash flow each year that is exposed to exchange rate changes - What is Totals interest expense for the Swiss franc debt for year 2015, measured in €?
Calculate the equation of this best fit straight line : Linear regression is a method for calculating the equation of the "best" straight line that passes through a set of points. By "best," we mean the "best fit" straight line—the one that passes as closely as possible to as many points as possible. To c..
Explain tcp protocol is asymmetric over wireless link : The following wireless TCP protocol is asymmetric over wireless link in terms of transmission power and bandwidth
Description of blue ocean strategy and its importance : A description of blue ocean strategy and its importance
Explain what each process means and what is involved : Explain what each process means and what is involved with the five that you picked. For clarification, these are the interconnected leadership tasks that are listed- Understanding the context and Understanding the people involved, including oneself
What is the role of leadership in creating : What is the role of leadership in creating, managing, and sustaining innovation in your organization?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Explain what his type of error message

Regards to a computer error. In Linux Lubuntu 15.04, there is a common error message that appears as "Reboot: System Halted" wondering if anyone can explain what his type of error message is and what it means.

  Create direct-mapped data cache for the byte offset

Create the 128KB direct-mapped data cache which uses a 32 bit address and 16 bytes per block. Compute the following: How many bits are utilized for the byte offset?

  Show the binary results for operations

Show the binary results for the subsequent operations using a 5-bit word - 2's complement arithmetic (8-16) and (12-13);

  What is the duration of a particular type

A microprocessor is clocked at a rate of 8 GHz. a. How long is a clock cycle? 1/frequency=1/(8*10^9) b. What is the duration of a particular type of machine instruction consisting of six clock cycles?

  Write code that fills an array with each set of numbers

Write code that fills an array with each set of numbers below. a. 1 2 3 4 5 6 7 8 9 10 b. 0 2 4 6 8 10 12 14 16 18 c. 1 4 9 16 25 36 49 64 81 100 d. 0 0 0 0 0 0 0 0 0 0 e. 1 4 9 16 9 7 4 9 11

  How these models would facilitate a company in the country

Review the IT diffusion models, select two models, then compare and contrast how these models would facilitate a company in the country and business sector of your choice. Be sure to state your business sector. Then, explain how the IT diffusion m..

  Simplify the following boolean expressions

Simplify the following Boolean expressions. a) xy + (x + y)z + y, b) x + y + (x + y + z), c) yz + wx + z + [wz(xy + wz)]

  Client health-care facilities-information-gathering process

shoulde patients in client health-care facilities participate in the information-gathering process? if so,why , and in what ways should they participate?

  Critical infrastructure protection

Critical Infrastructure Protection According to the text, Critical Infrastructure Protection (CIP) is an important cybersecurity initiative that requires careful planning and coordination in protecting our infrastructure.

  Short notes on web applications attack

The Software Development Director has asked you to provide a detailed presentation for her department regarding the most common Web application threats and the manner in which their products could compromise customer financial data.

  Event drive programming

Lets look at event drive programming. What is an event driven program? What are events associated with? What are examples of common events?

  Coordination between functional areas of the firm

• What are the ways in which a marketing audit can help improve coordination between functional areas of the firm?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd