linear regression analysis using ms excel tutorial for assignment 2 civ e 342
TRANSCRIPT
Linear Regression AnalysisUsing MS Excel
Tutorial for Assignment 2
Civ E 342
The Regression Analysis Procedure
Assume Equation
Import Data to Excel
Correlation Analysis
Prepare Data Table
Regress Using Excel
Quality Analysis
No
YesTry More Equ.?
Select the Best Equ.
Step 1: Import Data to Excel• Objective:
• Import original data to Excel. If it is a text file, open the file in Excel and follow the steps!
• Label each column - variable names
• Define (label) independent and dependent variables (x1,x2,...,y)
• Demo
Assume Equation
Import Data to Excel
Correlation Analysis
Prepare Data Table
Regress Using Excel
Quality Analysis
No
YesTry More Equ.?
Select the Best Equ.
Step 2: Correlation Analysis• Objectives:
– Important factors?
– Correlation between factors?
– Factors with non-linear effect - transform into linear if necessary
• Method 1: Correlation matrix– Excel - “Tools - Data Analysis… -
Correlation”
– Identify the factors that are correlated - high coefficient of correlation
• Method 2: Scatter diagram
• Demo
Assume Equation
Import Data to Excel
Correlation Analysis
Prepare Data Table
Regress Using Excel
Quality Analysis
No
YesTry More Equ.?
Select the Best Equ.
Step 3: Assume a Functional Form• Objective
– Identify factors and form of relationship
• Methods:– A trial-and-error process:
– Stepwise process (not covered in this tutorial)
Assume Equation
Import Data to Excel
Correlation Analysis
Prepare Data Table
Regress Using Excel
Quality Analysis
No
YesTry More Equ.?
Select the Best Equ.
y = 0 + 1 x1
y = 0 + 1 x1 + 2 x2
Step 4: Prepare Data Table
• Objective– For the assumed equation:
y = 0 + 1 x1 + 2 x2Assume Equation
Import Data to Excel
Correlation Analysis
Prepare Data Table
Regress Using Excel
Quality Analysis
No
YesTry More Equ.?
Select the Best Equ.
X1 X2 y
12 65 8765
4 76 9543
…
32 3 1287
Demo
Step 5: Regress Using Excel
• Objective: determine the coefficients that make the equation best fit to the data
• Method:– Method of Least Squares
• Demo
Assume Equation
Import Data to Excel
Correlation Analysis
Prepare Data Table
Regress Using Excel
Quality Analysis
No
YesTry More Equ.?
Select the Best Equ.
Step 6: Assess the Adequacy of the Regression Model
• Objective:• Measures:
– Coefficient of Determination (R2)
– t-tests
ti>t, n-k-1, -level of significance
n-sample size
k-no of independent variables
– Residual plot
– Intuitive acceptability
• Demo
Assume Equation
Import Data to Excel
Correlation Analysis
Prepare Data Table
Regress Using Excel
Quality Analysis
No
YesTry More Equ.?
Select the Best Equ.
Step 7: Select the Best Regression Model
• Objective:
• Model Application– Models are valid only for the values of the variables within the range of the original data!
Assume Equation
Import Data to Excel
Correlation Analysis
Prepare Data Table
Regress Using Excel
Quality Analysis
No
YesTry More Equ.?
Select the Best Equ.
y = 0 + 1 x1 + 2 x2
t1 t2 R2