Ch2 Linear Regression Analysis
Ch2 Linear Regression Analysis
LINEAR REGRESSION
ANALYSIS
Instructor: Lena Ahmadi
During
the
Lecture
E6-2004 Skype: L2ahm Ext.
Office L2ahm adi@u 37160
After Hour adi w...
the
Lecture
3
Previous Topic:
• Basic Stats
• Confidence Interval
• Hypothesis Testing
• P_Value
• Correlation and more…
• Linear Reg. Analysis (basics)
4
Topic Outline
• A few general remarks on
LRMS
• Estimation of parameters in
LRMs
• Inferences on the parameters
• Regression model diagnostics
– Scaled residual, PRESS,
R-Student
– Testing for lack of fit
5
A few general remarks on
LRMS
6
A few general remarks…
7
8
WHY IS MODELING
IMPORTANT?
9
USES OF MODELS
1. Process Understanding
– Direct further experimentation
– Reservoir/repository of knowledge
– Couplings/interactions, especially when
many factors change simultaneously!
– Transferability/inference engine
2. Process Simulation
– Parameter estimation
– Sensitivity analysis
– Design
10
USES OF MODELS (cont’d)
3. Process Optimization
– Grade changes (usually highly non-linear
problems)
4. Process Safety
5. Model-based Control
– Filtering/infer unmeasured properties
– Sensor development/selection
– Optimal sensor location
11
MODELING STAGES
Steps interrelated
12
From 2nd year, (Review) @ home
You are welcome to ask your questions during
office hour, over coffee, skype meeting, ….
GENERAL REGRESSION
MODEL
g ( yi ) = f ( x i , ) + i i = 1,2,..., n
*
where :
*
= denotes " true" values
13
(Review)
• Examples:
Linear
yi = 1* + 2* xi + i
Nonlinear
yi = 1* + exp 2* xi + i
yi = 1* + 2* x1i + 3* x2i + 4* x1i x2i + 5* x12i + 6* x22i + i Linear
1* x1i
ln( yi ) = + i Nonlinear
2.8 + 2* x2i
x x Linear
yi = 1* sin( x1i ) + 2* exp 1i 2i + i
9.8
14
(Review)
LINEAR REGRESSION
where :
y = g ( yi ) i th element
nx1
X = f j ( xi ) i, j th element
nxp
* = *j j th element
px1
= i i th element
nx1
15
(Review)
E ( ) = 0 V ( ) = I 2
16
(Review)
Estimation of parameters in
LRMs
17
(Review)
MAXIMUM LIKELIHOOD
ESTIMATE OF THE LINEAR
REGRESSION PARAMETERS
• Now, assume:
: N (0, I 2 )
y = X * +
y : N ( X * , I 2 )
exp − (z − ) V (z − )
1 1 −1
f ( z) =
(2 ) n 2 V 2
12
18
(Review)
(
Let : Z ( ) = y − X ) (y − X ); K1 =
1
(2 ) n / 2 n
; K 2 =
1
2 2
L( ) = K1 exp− K 2 Z ( )
̂ = X X ( ) −1
X y
We also call this OLSE, meaning ordinary least
squares estimator
19
(Review)
EXAMPLE
16.4
Model : yi = 1* + 2* xi + 3* + i
xi
Data :
y x
( )
13.84 10
−1
11.70
10.11
15
20
̂ = X X Xy
10.82 25
10.07 30
13.84 1 10 1.640
1
11.70 15 1.093
y = 10.11 X = 1 20 0.820
10.82 1 25 0.656
10.01 1 0.546
30
56.54 4.083
X y = 1088.70 ˆ = 0.109
56.38 5.294
20
Ice Cream Example
21
Inferences on the
parameters
22
INFERENCES ON THE
PARAMETERS
V ( ˆ ) = (X X )
i ii
−1
2
( )
• Under the assumption of −1
normality for the errors: ˆ : N ( * , X X 2
)
( )
ˆi : N ( *i , X X ii
−1
2)
(Review)
23
(Review)
ˆi t 2, n − p s (X X )ii
−1
2 unknown
Recall :
Z( ) = ( y − X ) ( y − X )
(
) (
= y y − ˆ X y + − ˆ X X − ˆ )
The minimum of Z ( ) occurs when = ˆ . This is called
the residual sum of squares.
RSS = y y − ˆ X y Note: In some books, instead of SSE
SSE
(sum pf squared of Error), you would
SSE
RSS see RSS (Residual sum of squared)
s2 =
n− p or SSres (Sum of squared of
residual),all are the same
• For the previous example, 95% confidence
intervals for the parameters are:
1 : 4.082 18.523
2 : 0.109 0.503
3 : 5.294 9.107
• Any concerns?
24
Ice Cream Example
25
JOINT CONFIDENCE
REGIONS
( ) ( )( )
− X X − ˆ 2 2p,
ˆ 2 known
26
MODEL PREDICTIONS
yˆ 0 = w0 ̂
• From this we can obtain information about:
– the mean response (confidence interval)
– the prediction of a single future
measurement (prediction interval)
• Confidence interval (CI) on fitted values:
( )
yˆ 0 z 2 w0 X X
−1
w0
• Heterogeneous Variance:
– Assume V() = I2
– affects the minimum variance property of
the parameter estimates; loss of precision.
28
Some remarks
• Correlated errors:
– loss of parameter precision; invalidates
significance tests
– occurs when data are collected in a time
sequence; pollutant emissions with time,
biological studies, batch reactors.
– Time Series Analysis.
– Generalized Least Squares.
29
– Little confidence can be placed in least
squares estimates dominated by such
points.
– Study the impact of such points.
• Model inadequacies:
– assume that the model is valid.
– The parameter estimates are unbiased only
if the model is correct.
• Collinearity
– solution is very unstable; small changes in
the independent or dependent variables
can cause drastic changes in the
parameter estimates.
– Variances of the parameter estimates
involved (near singularity situations)
become very large.
– Impact of collinearity very serious, if the
objective is to estimate parameters or
identify important variables; less serious, if
objective is simply fitting.
– What else can we do to protect ourselves
in practical cases?
30
Problems With Highly Correlated Parameter
Estimates
31
Some Useful Equations
32
33
Var (β)
𝒚)
Var (ෝ
Var (e)
Var (𝒚𝒑𝒓𝒆𝒅𝒊𝒄𝒕𝒆𝒅 )
34
Ozone Example
35
Regression model
diagnostics
36
Model Adequacy Checking
37
What are diagnostic methods
to check the violation of
regression assumption?
• The validity of these assumption is needed for
the results to be meaningful. If these
assumptions are violated, the result can be
incorrect and may have serious consequences.
38
Diagnostic Methods
• Residual analysis
1. Standardized residuals
2. Studentized residuals
3. PRESS residuals
4. R-student
39
Case of one regressor
40
Case of more than one
regressor
41
Another option…
(for Case of more than one regressor)
Another option to present the scatterplot is
– Present the scatterplots in the upper
triangular part of plot matrix.
Mention the corresponding correlation
coefficients in the lower triangular part of the
matrix.
Suppose there are only two explanatory variables
and the model is ,
then the scatterplot matrix looks like as follows:
42
But…
43
Residual Analysis
45
Standardized residuals
Therefore:
46
Studentized residuals
47
• Thus , so residuals are the same linear
transformation of y and ɛ.
• So
48
Standardized or studentized
residual?
51
Testing for lack of fit
52
Modeling Stage
Maximum Likelihood
Model Diagnostics
Concept Map
Design of
Statistical
Experiments
53
General Intro:
Reminder:
Some Useful Equations
54
55
56
57