370 likes | 542 Views
Chapter 12 and 13 Simple Linear and Multiple Regression. Simple Linear Regression Analysis Multiple Regression Analysis and Model Building. Simple Regression Analysis. Also called “Bivariate Regression” It analyzes the relationship between two variables
E N D
Chapter 12 and 13Simple Linear and Multiple Regression • Simple Linear Regression Analysis • Multiple Regression Analysis and Model Building BUS304 – Chapter 12 Simple Regression Analysis
Simple Regression Analysis • Also called “Bivariate Regression” • It analyzes the relationship between two variables • It is regarded as a higher lever of analysis than correlation analysis • It specifies one dependent variable (the response) and one independent variable (the predictor, the cause). • It assumes a linear relationship between the dependent and independent variable. • The output of the analysis is a linear regression model, which is generally used to predict the dependent variable. BUS304 – Chapter 12 Simple Regression Analysis
The regression Model • The model assumes a linear relationship • Two variables: • x – independent variable (the reason) • y – dependent variable (the result) • For example, • x can represent the number of customers dinning in a restaurant • y can represent the amount of tips collected by the waiter • Parameters: • 0: the intercept – represents the expected value of y when x=0. • 1: the slope (also called the coefficient of x) – represents the expected increment of y when x increases by 1 • : the error term – the uncontrolled part yi = 0 + 1 * xi+ i BUS304 – Chapter 12 Simple Regression Analysis
Graphical explanation of the parameters • Assume this is a scatter plot of the population 1 BUS304 – Chapter 12 Simple Regression Analysis
Building the model • The regression model is used to • predict the value of y • explain the impact of x on y • Scenarios, • x is easily observable, but y is not; or • x is easily controllable, but y is not; or • x will affect y, but y cannot affect x. • The causality should be carefully justified before building up the model • When assigning x and y, make sure which is the reason and which is the result. – otherwise, the model is wrong! • Example: Information System research: • “Ease of use” vs. “The Usefulness” • There may always be a second thought on the causality. BUS304 – Chapter 12 Simple Regression Analysis
Example • Build up the regression models • At State University, a study was done to establish whether a relationship existed between a student’s GPA when graduating and SAT score when entering the university. • The Skeleton Manufacturing Company recently did a study of its customers. A random sample of 50 customer accounts was pulled from the computer records. Two variables were observed: • The total dollar volume of business this year • Miles away the customer is from corporate headquarters BUS304 – Chapter 12 Simple Regression Analysis
Estimate the coefficient • Regression Model • Given 0=2 and 1=3, • If knowing x=4, we can expect y. How to know 0=2 and 1=3? • To know 0 and 1, we need to have the population data for all x and y. • Normally, we only have a sample. • The trend line determined by a sample is an estimation of the population trend line. The Fitted Model yi = 0 + 1 * xi+ i b0 and b1 are estimations of 0 and 1, they are sample statistics The hat indicates a predicted value BUS304 – Chapter 12 Simple Regression Analysis
Estimate the coefficients • Based on the sample collected • Run “simple regression analysis” to find the “best fitted line”. • The intercept of the line: b0 • The slope of the line: b1 • They are estimates of 0 and 1 • We can use b0 and b1 to predict y when we know x The prediction model BUS304 – Chapter 12 Simple Regression Analysis
How to determine the trend line? • The trend line is also called the “best fitted line” • How to define the “best fitted line”? • There could be a lot of criteria. • The most commonly used one: • The “Ordinary Least Squares” Regression (OLS) • To find the line with the least aggregate squared residual • Residual: for each sample data point i, the y value (yi) is not likely to be exactly the predicted value ( ), the residue: BUS304 – Chapter 12 Simple Regression Analysis
Solution for OLS regression • The objective function: • Find the best b0 and b1, which minimize the sum of squared residuals • Solution: • Use Excel: • Add a trend line • Run a regression analysis (Data Analysis too kit) BUS304 – Chapter 12 Simple Regression Analysis
Exercise • Open “Midwest.xls” • Create a scatter plot • Add a trend line. • Provide your estimation of y when • x = 10 • x = 0 • x = 4 • Residue: ei, for each sample data point. • In regression analysis, we assume that the residues are normally distributed, with mean 0 • The smaller the variance of residue, the stronger the linear relationship. BUS304 – Chapter 12 Simple Regression Analysis
y= 175.8 + 49.91*x Add a trend line • Step 1: Use your scatter plot, right click one data point, choose the option to “add trend line” • Step 2: choose “option tag”, check “Display equation on chart” “OK” BUS304 – Chapter 12 Simple Regression Analysis
The “Fitness” • Sometimes, it is just not a good idea to use a line to represent the relationship: Just see how well the sample data form a line -- how well the model predicts Not good ! kinda good better BUS304 – Chapter 12 Simple Regression Analysis
The measurement for the fitness • The Sum of Squared Errors (SSE) • The smaller the SSE, the better the fit. • In the extreme case, if every point lies on the line, there is no residual at all, SSE=0 (Every prediction is accurate) • SSE also increase when the sample size gets larger (more terms to sum up) -- however, this doesn’t indicate a worse fitness. • Other associated terms: • SST – total sum of squares: • Total variation of y • SSR – sum of squares Regression • Total variation of y explained by the model • It can be computed that SST, SSR, and SSE has the following relationship: BUS304 – Chapter 12 Simple Regression Analysis
R2 • A standardized measure of fitness: • Interpretation: • The proportion of the total variation in the dependent variable (y) that is explained by the regression model • In other words, the proportion that is not explained by the residuals. • The larger the R2, the better the fitness • In the Simple Linear Regression Model, R2=r2. • Compute the correlation and verify. BUS304 – Chapter 12 Simple Regression Analysis
Read the regression report • Step 1: check the fitness • whether the model is correct • Step 2: what are the coefficients, whether the slope of x is too small? • Interval Estimation of 0 and 1: (conf level: 95%) • 0: 53.3~298.2529 • 1: 26.5~73.31 Better greater than 0.3, The greater the better. p-value of 0 =0 y= 175.8 + 49.91*x p-value of 1 =0 BUS304 – Chapter 12 Simple Regression Analysis
Confidence Interval Estimation Input the required confidence level BUS304 – Chapter 12 Simple Regression Analysis
Hypothesis Test • People are normally interested in whether 1 is 0 or not. • In other words, whether x has an impact on y. • Based on the report from excel, it is very convenient to conduct such a test. • Simply compare whether the p value of the coefficient is smaller than or not. • Hypothesis: H0: 1 =0 HA: 1 0 • Decision rules: • If p < , reject the null hypothesis, • If p , do not reject the null hypothesis. • Compare p and , make the decision. BUS304 – Chapter 12 Simple Regression Analysis
When you don’t have a good fit • If the fitness is not good, that is, the correlation between x and y is not strong enough. • It is always a good idea to check the scatter plot first. • Cases • Case A. Maybe there are outliers (explain the outlier) BUS304 – Chapter 12 Simple Regression Analysis
Y Y X X Not a good fit? • Case 2: • Check the variation of x. • In order to have a good prediction model, the independent variable should cover a certain range. • Collect more data while guarantee the variations of x. • Case 3: • Inherently non-linear relationship • Non-linear regression (not required) • Segment regression • Separate your data into groups and run regression separately. BUS304 – Chapter 12 Simple Regression Analysis
Exercise • Problem 12.14 (Page 498) • Problem 12.15 • Problem 12.19 BUS304 – Chapter 12 Simple Regression Analysis
Multiple regression analysis • An extension of the simple regression model: • k: number of total factors being studied • x1, x2, …, xk: the value of independent variables • y: the dependent variable • 0, 1, 2, …, k: the coefficients Example • Independent variable (y): annual income • Dependent variables (k=2) • x1: years in school • x2: years of working BUS304 – Chapter 12 Simple Regression Analysis
Why Multiple Regression? • Limitations of Bivariate Regression: • Often too simplistic • Biased estimates if relevant predictors are omitted • Lack of fit does not show that X is unrelated to Y if the true model is multivariate • Use Bivariate Regression only when • There is a compelling need for a simplified model • Other predictors have only modest effects and a single logical predictor “stands out”. BUS304 – Chapter 12 Simple Regression Analysis
Data Format • Regression Model • Prediction Model • Data Format BUS304 – Chapter 12 Simple Regression Analysis
Building up the model • Decide the question you want to ask • the dependent variable (y) • List the potential independent variables (x1, …,xk) • All the factors you think might affect the dependent variable. • Different people may come up with different set of independent variables • Reflects your knowledge on the subject • In practice, you might not get data for all the factors, • try to get as many as you can. • Pre-select the most relevant factors to limit the number of your survey questions. BUS304 – Chapter 12 Simple Regression Analysis
Pre-selection • Use correlation matrix to pre-study • Example “First-city.xls” • It is always good to run a correlation analysis to check whether all the factors are relevant. • “Data Analysis” “Correlation” • Use hypothesis test to see whether all the factors are correlated with the dependent variable. (H0: =0) • See the correlation between pair of factors, try to explain why to predetermine whether the data make sense • Delete the ones which have too small correlation. BUS304 – Chapter 12 Simple Regression Analysis
Run regression • “Data Analysis” “regression” • Read the report: • Fitness: determine whether the model is good or not. • Significance of the model Good Fit BUS304 – Chapter 12 Simple Regression Analysis
Run Regression (cont’d) • Coefficients: • The prediction model • All the factors are not likely to have a coefficient 0. • The meaning of each coefficient: • The increment of y when each factor changes while keeping the other factors the same. BUS304 – Chapter 12 Simple Regression Analysis
If you didn’t get a good fit • Check the correlation matrix: • Whether there is some factor (independent variable) which do not have a strong correlation with the dependent variable? • Whether there is some too strong correlation between two independent variables? • If so, adjust the model and run regression again, see whether the “fitness” improves. • Still not, then check the p-value for each coefficient of the independent variable (s) delete those independent variable and run regression again. • Still cannot get a good fit? Maybe because of non-linearity. Check the scatter plots. BUS304 – Chapter 12 Simple Regression Analysis
How many factors? • There is always a question about how many independent variables should be incorporated into the model. • As many as possible? • As few as possible? • Principle of Occam’s Razor • When two explanations are otherwise equivalent, we prefer the simpler, more parsimonious one. • Intuition Rules: • Whether the model makes sense! • Example: Use the data Newhomes.xls BUS304 – Chapter 12 Simple Regression Analysis
Notes on regression coefficients • Regression coefficient shows the increment of dependent variable when the independent variable increases by one unit, and the other independent variables keep the same value. Regression coefficients (s) are not the correlation! Coefficients (s) vary when regression model changes! BUS304 – Chapter 12 Simple Regression Analysis
Exercise • Problem 13.4 (Page 538) BUS304 – Chapter 12 Simple Regression Analysis
Binary Predictors • What is a binary predictor? • A binary predictors has two values, denoting the presence or absence of a condition. (usually coded 0 and 1) • Examples: • Male/Female? Male=1/Female=0 • Employed? Employed =1/Unemployed =0 • West Coast? • Regression Model with Binary Predictors • Weight = vehicle curb weight as tested (pounds) • Manual = 1 if manual transmission, 0 if automatic MPG = 39.5 – 0.00463 Weight + 1.51 Manual BUS304 – Chapter 12 Simple Regression Analysis
Binary Predictor Model • Actually Two models • If Manual=0 (auto) • If Manual =1 • Meaning of the coefficient for the binary variable • The expected change of dependent variable when the binary variable is true or false. MPG = 39.5 – 0.00463 Weight MPG = 39.5 – 0.00463 Weight + 1.51 = 41.01 – 0.00463 Weight Manual =1 Manual =0 BUS304 – Chapter 12 Simple Regression Analysis
Underlying Assumption assumes that the slope is the same for both cases • You should test it by running regression on both groups and see whether there is a significant difference • Another way to test the possible different slopes is to use a refined model • If 3 is not significant (large p-value, likely to be 0), then you are fine with the original model. You should do the test if you have binary variables in your model MPG = 0 – 1Weight + 2 Manual + 3 (Manual*Weight) BUS304 – Chapter 12 Simple Regression Analysis
More than one binary variables • Example: Where are you from? • Midwest • Northeast • Southeast • West • How many independent variables? • Midwest + Northeast + Southeast + West =1 • That is, if Midwest = Northeast = Southeast = 0, West =1 • At least one is not “independent” Not included BUS304 – Chapter 12 Simple Regression Analysis
Review of Multivariate Regression • Start with a question interest of study (to predict, to dissect) Dependent Variable • Specify independent variables • Try to incorporate as much important independent variables as possible • Try to find those independent variables which are not too much correlated • Data Collection • Data Procession • Correlation analysis first to have a general idea, re-select factors to be incorporated in the model • Run regression, try different combinations to find the best model • The best model should both have a good fit and make good intuitive sense. • Pay attention to binary variables. BUS304 – Chapter 12 Simple Regression Analysis