PROGRAM 6: Curve Fitting to fit a straight line to a given set of data points using Least Square Method If data is in terms of two variables x and y then.

Slides:



Advertisements
Similar presentations
Least Squares Equation / Coefficient of Correlation
Advertisements

Kin 304 Regression Linear Regression Least Sum of Squares
Statistical Techniques I EXST7005 Simple Linear Regression.
Chapter 10 Regression. Defining Regression Simple linear regression features one independent variable and one dependent variable, as in correlation the.
Developing and Using a Simple Regression Equation. The simple regression model is based on the equation for a straight line: Yc = A+BX.
Regression Regression: Mathematical method for determining the best equation that reproduces a data set Linear Regression: Regression method applied with.
Read Chapter 17 of the textbook
EGR 105 Foundations of Engineering I Fall 2007 – week 7 Excel part 3 - regression.
EGR 105 Foundations of Engineering I Fall 2007 – week 7 Excel part 3 - regression.
Objective - To combine like terms to simplify expressions.
Correlation and simple linear regression Marek Majdan Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD;
02 – Object Modeling Overview Point Selection Bounding Box Line Equation Least Square Line Equation Conclusions.
Regression Maarten Buis Outline Recap Estimation Goodness of Fit Goodness of Fit versus Effect Size transformation of variables and effect.
CISE301_Topic41 CISE301: Numerical Methods Topic 4: Least Squares Curve Fitting Lectures 18-19: KFUPM Read Chapter 17 of the textbook.
Section 5.2: Linear Regression: Fitting a Line to Bivariate Data.
Y=a+bx Sum of squares of errors Linear Regression: Method of Least Squares The Method of Least Squares is a procedure to determine the best fit line to.
Sec 1.5 Scatter Plots and Least Squares Lines Come in & plot your height (x-axis) and shoe size (y-axis) on the graph. Add your coordinate point to the.
Thomas Knotts. Engineers often: Regress data  Analysis  Fit to theory  Data reduction Use the regression of others  Antoine Equation  DIPPR.
10B11PD311 Economics REGRESSION ANALYSIS. 10B11PD311 Economics Regression Techniques and Demand Estimation Some important questions before a firm are.
Simple Linear Regression. The term linear regression implies that  Y|x is linearly related to x by the population regression equation  Y|x =  +  x.
Curve Fitting Pertemuan 10 Matakuliah: S0262-Analisis Numerik Tahun: 2010.
y=a+bx Linear Regression: Method of Least Squares slope y intercept y
STATISTICS 12.0 Correlation and Linear Regression “Correlation and Linear Regression -”Causal Forecasting Method.
Dependent (response) Variable Independent (control) Variable Random Error XY x1x1 y1y1 x2x2 y2y2 …… xnxn ynyn Raw data: Assumption:  i ‘s are independent.
V. Rouillard  Introduction to measurement and statistical analysis CURVE FITTING In graphical form, drawing a line (curve) of best fit through.
Chapter 8 Loops. For Loop >Executes a block of statements a specified number of times. Form: for loop variable=first:incr:last statements end.
Review after Christmas!. Solve the below equations for the variable..5 (6x +8) = 16 1.
The General Linear Model. Estimation -- The General Linear Model Formula for a straight line y = b 0 + b 1 x x y.
OLS Regression What is it? Closely allied with correlation – interested in the strength of the linear relationship between two variables One variable is.
Chapter 14 Introduction to Regression Analysis. Objectives Regression Analysis Uses of Regression Analysis Method of Least Squares Difference between.
Mrs. Manley Systems of Equations How do you find solutions to systems of two linear equations in 2 variables?
Regression and Correlation of Data Correlation: Correlation is a measure of the association between random variables, say X and Y. No assumption that one.
Regression lines A line of best fit should: Go through ( x , y )
Notes on Weighted Least Squares Straight line Fit Passing Through The Origin Amarjeet Bhullar November 14, 2008.
1. Write the equation in standard form.
Regression and Correlation of Data Summary
Statistics 101 Chapter 3 Section 3.
Practice. Practice Practice Practice Practice r = X = 20 X2 = 120 Y = 19 Y2 = 123 XY = 72 N = 4 (4) 72.
Chapter 13 Linear Regression and Correlation Basic Statistics
Two Quantitative Variables
Combining Like Terms.
Kin 304 Regression Linear Regression Least Sum of Squares
Linear Regression Bonus
Equations of Lines.
G Lecture 10b Example: Recognition Memory
Objective #51: Graph linear inequalities in 2 variables
BPK 304W Regression Linear Regression Least Sum of Squares
Simple Linear Regression - Introduction
Slope of the regression line:
AP Stats: 3.3 Least-Squares Regression Line
y=a+bx Linear Regression: Method of Least Squares slope y intercept y
Least-Squares Regression
13. Mathematics and health
Introduction to Probability and Statistics Thirteenth Edition
Determination of I- in Salt (Ion-Selective Electrode)
The Least-Squares Line Introduction
CHAPTER 7-1 CORRELATION PROBABILITY.
5.4 General Linear Least-Squares
Least-Squares Regression
Correlation and Regression
y=a+bx Linear Regression: Method of Least Squares slope y intercept
Introduction to Regression Analysis
Multivariate Analysis Regression
Ch 4.1 & 4.2 Two dimensions concept
Mathematical Relationships
Notes Over 2.4 Writing an Equation Given the Slope and y-intercept
Slope-intercept Form of Equations of Straight Lines
Sleeping and Happiness
Ch. 6 Vocabulary 7.) Substitution method (6-2) 8.) Elimination method (6-3)
EXHIBIT 1 Three Categories of Resources
Presentation transcript:

PROGRAM 6: Curve Fitting to fit a straight line to a given set of data points using Least Square Method If data is in terms of two variables x and y then finding an expression of the type y = f(x) which fits the givens data is called curve fitting. Assume that the given data consists of n points with values of x and y given as (x 1,y 1 ),(x 2,y 2 ),……(x n,y n ) By method Least Squares the data fits to a straight line y = A + B x with B = { n ∑x i y i - ∑x i ∑y i } / { n ∑x i 2 – ( ∑ x i ) 2 } and A = y¯ – B x¯ where y¯ is mean value of variable y x¯ is mean value of variable x

C PROGRAM TO FIT A STRAIGHT LINE Y=A+BX TO A GIVEN SET C OF POINTS DIMENSION X(10),Y(10) WRITE(*,*)’INPUT NUMBER OF DATA POINTS’ READ(*,*)N WRITE(*,*)’INPUT X AND Y VALUES’ DO 10 I =1,N READ(*,*) X(I),Y(I) 10 CONTINUE SX=0.0 SY=0.0 SXY=0.0 SXX=0.0 DO 20 I=1,N SX=SX+X(I) SY=SY+Y(I) SXX=SXX+X(I)*X(I) SXY=SXY+X(I)*Y(I) 20 CONTINUE

X MEAN=SX/N Y MEAN=SY/N DEN=N*SXX-SX*SX B=(N*SXY-SX*SY)/DEN A=Y MEAN-B*X MEAN WRITE(*,*)’THE STRAIGHT LINE OF BEST FIT IS Y=A+BX’ WRITE(*,*)’THE COEFFICIENTS ARE’ WRITE(*,*) ’INTERCEPT A =‘, A WRITE(*,*) ‘SLOPE B =‘, B STOP END