









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Types of models
Theoretical (parametric) model
Data follows from a theory.
Uses known theoretical laws or principles.
Example - Calibration curve of absorbance vs. concentration.
While the model may not be linear, we typically attempt to transform it to make it linear.
Types of models
Empirical (nonparametric) model. No theoretical basis for the model. An equation is simply fit to the data.
You must assume that the trend continues outside the experimental ranges.
Example - polynomial fit of a GC trace.
Linear models, Y = b 1 X
v (^) y^2
Y i - Y
! Y
2
We’re just trying to minimize the standard error (SE) for our model.
The optimum value for b1 is the one that minimizes the standard error. We also must assume that the values are homoscedastic: (unweighted least squares)
v (^) y^21 =v (^) y^22 =....=v (^) yn^2
SE = (^) v y^2
` Y (^) (^) i - Y^ ^j ! = (^) v y^2
! 1 ^ Y^ i - b i X i h^2
2
homoscedastic not homoscedastic
Linear model
b 1 =
b 1 =
v (^) y^21
x (^) i^2
v (^) y^21
x (^) i y (^) i
Example ppm abs xy x^2 1 0.020 0.020 1 2 0.038 0.076 4 3 0.064 0.192 9 4 0.077 0.308 16 5 0.105 0.525 25 sums 1.121 55
b 1 =
=0.0204 so Y =0.0204 X
Y-intercept
2
2
2
Source of Variance Sum of Squares DF
Model p
Residual n-p-
Total n-
Correlation coefficient
Correlation, |r| (^) 100 r 2 0.10 1 0.20 4 0.50 25 0.80 64 0.90 81 0.95 90 0.99 99 1.00 100
Relationship between correlation coefficient (r) and proportion of variance (r^2 ).
Correlation coefficient
Y
X
Y
X Y
X
Y
X
The same thing with Excel
It should come as no surprise that we can do the same calculations using Excel.
Two approaches Data analysis add-on Detailed analysis Trendlines Quick and dirty regression lines when producing a graph.
Excel Data Analysis add-on
Excel Data Analysis add-on Excel trendline
Data transformations
Transform Equation of the line Y X Y = b X + a Y 1/X Y = a + b / X 1/Y X Y = 1 / ( a + b X ) X/Y X Y = X / ( a + b X ) log Y X Y = a b X log Y log X Y = a Xb Y Xn^ Y = a + b X n
b = slope, a = intercept.
MLR assumes a linear relationship between Xi and y, with superimposed noise (e). It
also assumes that there are no interactions between X 1 , X 2 , … Xn.
Y = b 0 + b 1 X 1 + b 2 X 2 +.... bnXn + e
We then ‘fit’ a regression equation. The bn values are considered to be estimates of the true population parameters, βn.
Multiple linear regression
b 1! X (^) 12 + b (^) 2! X (^) 1 X (^) 2 = (^)! YX (^) 1 b (^) 2! X (^) 22 + b 1! X (^) 1 X (^) 2 = (^)! YX (^) 2
Multiple linear regression
Results must be interpreted more carefully that with simple regression. All of the b values are now tied together and must be interpreted as a group.
R^2 values will increase as you add additional X values to the model - even random numbers.
Use adjusted R^2 values to see if new predictors improved model.
Multiple linear regression
One advantage of an MLR approach is that you can obtain multiple measurements (X) for a single response. This can help eliminate noise.
We’ll look at one example using MLR - Determination of Octane Number by NIR.
We’ll revisit this example in a later unit when we compare it to other multivariate calibration methods.
Rating Octane of Gasoline using near-IR. ASTM method is complex and expensive. A simple spectral method would be more desirable.
Experimental A series of unleaded gasoline samples were assayed by the ASTM method. NIR spectra (900-1600 nm) were also obtained. A matrix was constructed from the spectra (20 nm intervals) were the X matrix and the ASTM octane number was the Y matrix.
A 915 nm, CH 2 stretch B 1021 nm, CH 2 /CH 3 combination band C 1151 nm, aromatic and CH 3 stretch D 1194 nm, CH 3 stretch E 1394 nm, CH 2 combination bands F 1412 nm aromatic & CH 2 combination bands G 1435 nm aromatic & CH2 combination bands
(^900 1000 1100 1200) Wavelength 1300 1400 1500 1600
Absorbance A
C B
D
C
E
F
G
Single variable - 900 - just for comparison.
Octane Number, MLR Octane Number, MLR
80
82
84
86
88
90
92
94
96
98
0.21 0.215 0.22 0.225 0.23 0. 900
Octane #
Active Validation Model Conf. interval(Mean 95%) Conf. interval (Obs. 95%)
Using the ‘best’ 4 lines Pred(Octane #) / Octane #
83
85
87
89
91
93
83 85 87 89 91 93 Pred(Octane #)
Octane # No significant change in the quality of the fit. Means you only need 4 lines to determine octane number.
Pred(Octane #) / Standardized residuals
-2.5-
-1.5-
-0.5^0
0.5^1
1.5^2 83 85 87 89 91 93
Pred(Octane #)
Standardized residuals
ANCOVA
Number of X variables Qual^ Quant^ Mixed
(^1) ANOVASimple LR -
2 or more ANOCA MLR ANCOVA
ANCOVA
ANCOVA examples
Both treatment and covariate variables are significant with the same model.
Covariate variable is significant, treatment is not.
Neither are significant. Both treatment and covariate variables are significant.
Treatment issignificant but covariate isnʼt.
Both treatment and covariate variables are significant but the models are different.
Modified Octane example
The near IR spectra can vary based not only on octane number.
The presence of oxygenates can cause changes.
Seasonal blends can also cause changes.
ANCOVA can be used to deal with this type of situation.
80
82
84
86
88
90
92
94
96
0.34 0.36 0.38 0.4 0. a
Octane #
Active Model Conf. interval (Mean 95%) Conf. interval (Obs. 95%)
Standardized residuals / a
-1.
-0.
0
1
2
0.34 0.36 0.38 0.4 0.
a
Standardized residuals Octane # / Standardized residuals
-1.
-0.
0
1
2
83 85 87 89 91 93
Octane #
Standardized residuals
It seems pretty clear that a simple linear regression has a problem. It is also obvious that there are two types of samples.
Evaluating a simple scatterplot may help.
y = 0.0023x + 0.159R 2 = 0.
y = 0.0021x + 0.2249R 2 = 0.
83.0 84.0 85.0 86.0 87.0 88.0 89.0 90.0 91.0 92.0 93.
SummerWinter Linear (Summer)Linear (Winter)
Let’s try an ANCOVA - using a1360 as the covariate and the ‘blend’ type as an additional factor.
Pred(Octane #) / Octane #
83
85
87
89
91
93
(^83 85) Pred(Octane #) 87 89 91 93
Octane # Octane # / Standardized residuals
-1.
-0.
0
1
2
3
83 85 87 89 91 93
Octane #
Standardized residuals
Non-linear regression
With many problems, it is not always possible to set up a simple linear regression solution, even with data transformation.
Non-linear regression methods permit the user to fit a set of parameters to a model which can involve many variables.
This type of problem is typically solved using a computer program.
Non-linear regression options
Typical options Initial estimate of parameters An initial guess of your values can not only save processing time but avoid false convergence as well.
Scaling of parameters The magnitude of your parameters can vary greatly. Scaling will give them comparable ‘weight’ during the fit.
Non-linear regression options
First Derivative Function Some programs require that you provide the first derivative (Jacobian) for your function. It is used to determine the best direction to try it’s next estimate.
Tolerance Various types including how big a jump it can make to the next estimate, how good the numbers are, ...
Maximum iterations How many ‘guesses’ it should attempt before quitting.
Limits Do you want to set any upper/lower limits for the parameters?
Convergence How good does the estimate need to be.
Non-linear regression
Each program has its own approach(s) as it attempts to find the optimum solution.
Your best bet is to: Try several different programs if possible. Test each program using the various options available. Try different rearrangements of your model to see what effect it has.
Things are usually OK if the changes above still result is the same basic solution
For this model, the goal is to determine the minimum error solution for the following:
RT =2479. | s =0. V (^) M = molar volume of solvent z f = polymer volume fraction h =( D (^) p - D (^) s )^2 +0.25 8 ^ P (^) p - Ps h^2 +( H (^) p - H (^) s )^2 B D (^) s , Ps , H (^) s - known constants D (^) p , Pp , H (^) p - parameters to be fit
Using Excel’s ‘Solver’
The Solver is a built in non-linear least squares function for Excel. Parameters are held in specific cells that it will alter to find a solution. It tests by seeking a minimize or maximize value held in another ‘cell’ All intermediates must be also be cell functions. Several options are available.
Experimental data Calculated values
We will be minimizing by tracking the sum of squares - that is what is held in the delta2 column
RT b^ V^ M^ h +| s l z f^2 +z f +ln (1 - z f ) = 0
Column B contains known constants for the experiment
Column E contains the values to be adjusted - Dp, Pp and Hp. SSE is the sum of squares that will be tested.
Using Excel’s ‘Solver’
Pred(A1) / A
0
1
2
0 0.5 1 1.5 2 2. Pred(A1)
A