Professional Documents
Culture Documents
Model fitting
Least-squares
Comparing models
Mathematical Modelling
Lecture 4 – Fitting Data
Phil Hasnip
phil.hasnip@york.ac.uk
Overview of Course
Aim
Aim
Model fitting
f (x) = a + bx + cx 2
Model fitting
Least-squares
Ri = yi − f (xi )
i.e. minimise
N
X
S= (yi − f (xi ))2
i=1
Least-squares
Least-squares
PN P P
N N
N i=1 xi yi − i=1 xi i=1 yi
m = P 2
PN 2− N
N x
i=1 i x
i=1 i
P P P P
N 2 N N N
x
i=1 i y
i=1 i − x
i=1 i iy x
i=1 i
c = 2
N N
P 2
PN
i=1 xi − i=1 xi
Least-squares
N
X
S= (yi − f (xi ))2
i=1
Data transformations
y = αeβx
⇒ ln y = ln α + βx
Goodness of fit
Different models
Different models
Different models
Different models
Degrees of freedom
F-test
χ22
F =
χ21
Critical F-values
Ri = yi − f (xi )
Errors
Systematic
e.g. your tape measure has stretched over time
Random
Measure several times, get slightly different results
Errors
Formulation
Assumptions made in model may not be strictly correct
Truncation
Might make approximations to series, e.g.
cos(x) ≈ 1 − 21 x 2
Round-off
Computers, calculators etc. can’t represent numbers
exactly
Errors
Summary