Kemometrik - Curve Fit Dan Regresi Linier 01
Kemometrik - Curve Fit Dan Regresi Linier 01
Kemometrik - Curve Fit Dan Regresi Linier 01
Regresi Linier
KIM 357 – Kemometrika
Departemen Kimia FMIPA IPB
[email protected]
Curve Fitting
n n n
S r = ∑ e = ∑ ( yi , measured − yi , model) = ∑ ( yi − a0 − a1 xi ) 2
2
i
2
i =1 i =1 i =1
n n
2 2
min S r = ∑ ei = ∑ ( yi − a0 − a1 xi )
i =1 i =1
n n
2 2
min S r = ∑ ei = ∑ ( yi − a0 − a1 xi )
i =1 i =1
∂S r
∂a = 0
0
∂S r = 0
∂a1
Linear Regression: Determination of ao and a1
∂S r
= −2∑ ( yi − ao − a1 xi ) = 0
∂ao
∂S r
= −2∑ [( yi − ao − a1 xi ) xi ] = 0
∂a1
0 = ∑ yi − ∑ a 0 − ∑ a1 xi
0 = ∑ yi xi − ∑ a 0 xi − ∑ a1 xi2
∑a 0 = na0
na0 + (∑ xi )a1 = ∑ yi 2 equations with 2 unknowns, can
be solved simultaneously
∑ yi xi = ∑ a 0 xi + ∑ a1 xi2
Linear Regression: Determination of ao and a1
n∑ xi yi − ∑ xi ∑ yi
a1 =
n ∑ x − (∑ xi )
2 2
i
a0 = y − a1 x
Error Quantification of Linear Regression
Total sum of the squares around the mean for the dependent variable, y, is St
St = ∑ i
( y − y ) 2
n n
S r = ∑ e = ∑ ( yi − ao − a1 xi ) 2
2
i
i =1 i =1
Error Quantification of Linear Regression
2 St − S r
r =
St
r2: coefficient of determination
r : correlation coefficient
Error Quantification of Linear Regression
xi yi xiyi xi2
∑ xi = 28 ∑ yi = 24.0
1 0.5 0.5 1
2 2.5 5 4
2
∑ i = 140
x ∑ xi yi = 119.5
3 2 6 9
2 8
4 4 16 16
x = =4
5 3.5 17.5 25 7
6 6 36 36
2 4
7 5.5 38.5 49 y= = 3.4 2 8 5
7
28 24 119.5 140
Least Squares Fit of a Straight Line: Example (cont’d)
n∑ xi yi − ∑ xi ∑ yi
a1 =
n∑ x − (∑ xi )
2 2
i
7 × 119.5 − 28 × 24
= 2
= 0.8392857
7 × 140 − 28
a0 = y − a1 x
= 3.428571 − 0.8392857 × 4 = 0.07142857
Y = 0.07142857 + 0.8392857 x
Least Squares Fit of a Straight Line: Example (cont’d)
^
2
xi yi (yi − y) e = ( yi − y ) 2
2
i
1 0.5 8.5765 0.1687 S t = (
∑ i y − y )2
= 22.7143
2 2.5 0.8622 0.5625
S r = ∑ ei = 2.9911
2
3 2.0 2.0408 0.3473
4 4.0 0.3265 0.3265
5 3.5 0.0051 0.5896 St − S r
2
6 6.0 6.6122 0.7972 r = = 0.868
St
7 5.5 4.2908 0.1993
28 24.0 22.7143 2.9911 2
r= r = 0.868 = 0.932
Least Squares Fit of a Straight Line: Example (Error Analysis)
St 22.7143
sy = = = 1.9457
n −1 7 −1
•The standard error of estimate (quantifies the spread around the regression line)
Sr 2.9911
sy / x = = = 0.7735
n−2 7−2
Because S y /,x < S y the linear regression model has good fitness
Linearization of Nonlinear Relationships