mX+b), using the least square method. It should be assumed that the input data file e first column includes the values of independent variable X and the second colum pendent variable Y. Use XYdata.txt as the input data for your program. The folle find the equation of line of best fit based on least square method. tep-1: Calculate the mean of the x-values and the mean of the y-values.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question

the XY data.txt is in the second image. solve using fortran

 

Write a program to read an ordered pairs of data points with unknown size and finds the line of best fit
(Y=mX+b), using the least square method. It should be assumed that the input data file has two columns where
the first column includes the values of independent variable X and the second column includes the values of
dependent variable Y. Use XYdata.txt as the input data for your program. The following steps can be used
to find the equation of line of best fit based on least square method.
Step-1: Calculate the mean of the x-values and the mean of the y-values.
X = *1+x2++xn
and
Y =
Yı+y2+…+yn
%3D
n
Step-2: the following formula gives the slope of the line of best fit,
(x1 – X)(y1 – Y) + (x2 – X)(y2 – Ý) + …+ (xn – X)(Yn – Y)
(x1 – X)2 + (x2 – X)² + .…·+ (xn – X)²
-
m =
Step-3: compute the y-intercept of the line by using the below formula,
b = Ỹ – mX
Step-4: print the line of best-fit equation on the screen as:
Linear equation of best fit is: Y = ( m )X + ( b )
Where m is slope magnitude and b is the intercept magnitude.
Transcribed Image Text:Write a program to read an ordered pairs of data points with unknown size and finds the line of best fit (Y=mX+b), using the least square method. It should be assumed that the input data file has two columns where the first column includes the values of independent variable X and the second column includes the values of dependent variable Y. Use XYdata.txt as the input data for your program. The following steps can be used to find the equation of line of best fit based on least square method. Step-1: Calculate the mean of the x-values and the mean of the y-values. X = *1+x2++xn and Y = Yı+y2+…+yn %3D n Step-2: the following formula gives the slope of the line of best fit, (x1 – X)(y1 – Y) + (x2 – X)(y2 – Ý) + …+ (xn – X)(Yn – Y) (x1 – X)2 + (x2 – X)² + .…·+ (xn – X)² - m = Step-3: compute the y-intercept of the line by using the below formula, b = Ỹ – mX Step-4: print the line of best-fit equation on the screen as: Linear equation of best fit is: Y = ( m )X + ( b ) Where m is slope magnitude and b is the intercept magnitude.
0.000
0.000
0.299
0.295
0.598
0.563
0.898
0.782
1.197
0.931
1.496
0.997
1.795
0.975
2.094
0.866
2.394
0.680
2.693
0.434
2.992
0.149
3.291
-0.149
3.590
-0.434
3.890
-0.680
4.189
-0.866
4.488
-0.975
4.787
-0.997
5.086
-0.931
5.386
-0.782
5.685
-0.563
5.984
-0.295
6.283
-0.000
6.582
0.295
6.882
0.563
7.181
0.782
7.480
0.931
7.779
0.997
8.078
0.975
8.378
0.866
8.677
0.680
8.976
0.434
9.275
0.149
9.574
-0.149
9.874
-0.434
10.173
-0.680
10.472
-0.866
10.771
-0.975
11.070
-0.997
11.370
-0.931
11.669
-0.782
11.968
-0.563
12.267
-0.295
12.566
-0.000
Transcribed Image Text:0.000 0.000 0.299 0.295 0.598 0.563 0.898 0.782 1.197 0.931 1.496 0.997 1.795 0.975 2.094 0.866 2.394 0.680 2.693 0.434 2.992 0.149 3.291 -0.149 3.590 -0.434 3.890 -0.680 4.189 -0.866 4.488 -0.975 4.787 -0.997 5.086 -0.931 5.386 -0.782 5.685 -0.563 5.984 -0.295 6.283 -0.000 6.582 0.295 6.882 0.563 7.181 0.782 7.480 0.931 7.779 0.997 8.078 0.975 8.378 0.866 8.677 0.680 8.976 0.434 9.275 0.149 9.574 -0.149 9.874 -0.434 10.173 -0.680 10.472 -0.866 10.771 -0.975 11.070 -0.997 11.370 -0.931 11.669 -0.782 11.968 -0.563 12.267 -0.295 12.566 -0.000
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education