Successfully reported this slideshow.
Upcoming SlideShare
×

# Lecture7a Applied Econometrics and Economic Modeling

1,066 views

Published on

Applied Econometrics and Economic Modeling

Published in: Education
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### Lecture7a Applied Econometrics and Economic Modeling

1. 1. Simple Regression Scatterplots: Graphing Relationships
2. 2. Background Information <ul><li>Pharmex is a chain of drugstores that operates around the country. </li></ul><ul><li>To see how effective their advertising and other promotional activities are, the company has collected data from 50 randomly selected metropolitan regions. </li></ul><ul><li>In each region it has compared its own promotional expenditures and sales to those of the leading competitor in the region over the past year. </li></ul>
3. 3. Background Information -- continued <ul><li>There are two variables each of which are indexes, not dollar amounts. </li></ul><ul><ul><li>Promote: Pharmex’s promotional expenditures as a percentage of those of the leading competitor </li></ul></ul><ul><ul><li>Sales: Pharmex’s sales as a percentage of those of the leading competitor </li></ul></ul><ul><li>The company expects that there is a positive relationship between the two variables, so that regions with relatively more expenditures have relatively more sales. However, it is not clear what the nature of this relationship is. </li></ul>
4. 4. PHARMEX.XLS <ul><li>The data are listed in this file. Here is a partial listing. </li></ul><ul><li>What type of relationship, if any, is apparent in a scatterplot? </li></ul>
5. 5. Creating the Scatterplot <ul><li>In preparing to create the scatterplot we must decide which variable should be on the horizontal axis. </li></ul><ul><li>In regression analysis, we always put the explanatory variable on the horizontal axis and the response variable on the vertical axis. </li></ul><ul><li>In this example the store tends to believe that large promotional expenditures “cause” larger values of sales, so we put Sales on the vertical axis and Promote on the horizontal axis. </li></ul>
6. 6. Creating the Scatterplot -- continued <ul><li>We create the following scatterplot using StatPro’s Scatterplot procedure. </li></ul>
7. 7. Interpretation <ul><li>The scatterplot indicates that there is a positive relationship between Promote and Sales - the points tend to rise from bottom left to top right - but the relationship is not perfect. </li></ul><ul><li>The correlation of 0.673 is shown automatically on the plot. The important things to note about the correlation is that it is positive and its magnitude is moderately large. </li></ul>
8. 8. Causation <ul><li>Unless the data is obtained in a carefully controlled experiment - not the case here - we can never make definitive statements about causation in regression analysis. </li></ul><ul><li>The reason for this is that we can almost never rule out the possibility that some other variable is causing the variation in both of the observed variables. </li></ul>
9. 9. Background Information <ul><li>In Example 13.1 we created scatterplots for Pharmex. </li></ul><ul><li>We found that there was a positive but not perfect relationship between Promote and Sales. </li></ul><ul><li>We now want to find the least squares line for the Pharmex drugstore data, using Sales as the response variable and Promote as the explanatory variable. </li></ul>
10. 10. PHARMEX.XLS <ul><li>The data are listed in this file. Here is a partial listing. </li></ul>
11. 11. Least Squares Estimation <ul><li>Since there are hints of a linear relationship between the two variables we can draw a line through the points to produce a reasonably good fit. </li></ul><ul><li>However, we need to proceed systematically and not just randomly draw lines. We must choose the line that makes the vertical distances from the points to the line as small as possible. </li></ul><ul><li>The fitted value is the vertical distance from the horizontal axis to the line and the residual is the vertical distance from the line to the point. </li></ul>
12. 12. Least Squares Estimation -- continued <ul><li>The idea is simple. By using a straight line to reflect the relationship between Promote and Sales, we expect a given Sales to be at the height of the line above any particular value of Promote. That is, we expect Sales to equal the fitted value. </li></ul><ul><li>But the relationship is not perfect. Not all points lie exactly on the line. The differences are the residuals.. They show how much the observed values differ from the fitted values. </li></ul>
13. 13. Least Squares Estimation -- continued <ul><li>We can now explain how to choose the “best fitting” line through the points in the scatterplot. We choose the line with the smallest sum of the squared residuals. This line is called the least squares line. </li></ul><ul><li>Most statistical packages perform the calculations to find this line so we need not be concerned with the technical details and hand calculating. </li></ul>
14. 14. Finding the Least Squares Line with StatPro <ul><li>We use the StatPro/Regression Analysis /Simple menu item. </li></ul><ul><li>After specifying that Sales is the response (dependent) variable and that Promote is the explanatory (independent) variable, we see the dialog box for scatterplot options as seen here. </li></ul>
15. 15. Finding the Least Squares Line with StatPro -- continued <ul><li>This gives us the option of creating several scatterplots involving the fitted values and residuals. </li></ul><ul><li>The regression output includes three parts. The first two are a list of fitted values and residuals, placed in columns next to the data set, and any scatterplots selected from the dialog box. </li></ul><ul><li>The third part of the output is the most important. It is shown on the next slide. </li></ul>
16. 16. Regression Output Table
17. 17. The Regression Output <ul><li>We will eventually learn what all the output in the table means but for now we will concentrate on a small part. </li></ul><ul><li>Specifically we find the intercept and slope of the least squares line under the Coefficient label in cells C16 and C17. </li></ul><ul><li>They imply that the equation for the least squares line is Predicated Sales = 25.1264 + 0.7623Promote </li></ul>
18. 18. Least Square Line Equation <ul><li>We can interpret this equation as follows. </li></ul><ul><ul><li>The slope 0.7623 indicates that the sales index tends to increase by about 0.76 for each unit increase in the promotional expenses index. </li></ul></ul><ul><ul><li>The interpretation of the intercept is less important. It is literally the predicted sales index for a region that does no promotions. </li></ul></ul><ul><li>For instances like this when the range of observed explanatory variable values does not include 0, it is best to think of the intercept as an “anchor” for the least squares line. </li></ul>
19. 19. The Scatterplot <ul><li>A useful graph in almost any regression analysis is a scatterplot of residuals (on the vertical axis) versus fitted values. </li></ul><ul><li>The scatterplot for this data appears on the following slide. </li></ul><ul><li>We typically examine the scatterplot for striking patterns. </li></ul><ul><li>A “good” fit not only has small residuals, but it has residuals scattered randomly around 0 with no apparent pattern. This is the case here. </li></ul>
20. 20. The Scatterplot of Residuals versus Fitted Values for Pharmex
21. 21. Scatterplots: Graphing Relationships
22. 22. Background Information <ul><li>The Bendrix Company manufactures various types of parts for automobiles. </li></ul><ul><li>The manager of the factory wants to get a better understanding of overhead costs. </li></ul><ul><li>These overhead costs include supervision, indirect labor, supplies, payroll taxes, overtime premiums,depreciation, and a number of miscellaneous items such as insurance, utilities, and janitorial and maintenance expenses. </li></ul>
23. 23. Background Information -- continued <ul><li>Some of the overhead costs are “fixed” in the sense they do not vary appreciably with the volume of work being done, whereas others are “variable” and do vary directly with the volume of work being done. </li></ul><ul><li>It is not easy to draw a clear line between the fixed and variable overhead components. </li></ul><ul><li>The Bendrix manager has tracked total overhead costs for 36 months. </li></ul>
24. 24. Background Information -- continued <ul><li>To help explain these he also collected data on two variables that are related to the amount of work done at the factory. These variables are: </li></ul><ul><ul><li>MachHrs: number of machine hours used during the month </li></ul></ul><ul><ul><li>ProdRuns: the number of separate production runs during the month </li></ul></ul><ul><ul><ul><li>To understand this variable we must know that Bendrix manufactures parts in fairly large batches called production runs. Between each run there is a downtime. </li></ul></ul></ul><ul><li>The manager believes both of these variables might be responsible for variations in overhead costs. Do scatterplots support his belief? </li></ul>
25. 25. BENDRIX1.XLS <ul><li>The data collected by the manager appears in this file. </li></ul><ul><li>Each observation (row) corresponds to a single month. </li></ul><ul><li>We want to investigate any possible relationship between the Overhead variable and the MachHrs and ProdRuns variables but because these are time series variables we should also look out for relationships between these variables and the Month variable. </li></ul>
26. 26. The Scatterplots <ul><li>This data set illustrates, even with the modest number of variables, how the number of potentially useful scatterplots can grow quickly. </li></ul><ul><li>At the least, we need to look at the scatterplots between each potential explanatory variable (MacHrs and ProdRuns) and the response variable (Overhead). </li></ul><ul><li>These scatterplots are as follows: </li></ul>
27. 27. Scatterplot of Overhead versus Machine Hours
28. 28. Scatterplot of Overhead versus Production Runs
29. 29. The Scatterplots -- continued <ul><li>To check for possible time series patterns we can also create a time series plot for any of the variables. This is equivalent to a scatterplot of the variable versus the Month, with the points joined by lines. </li></ul><ul><li>One of these is the time series plot for Overhead. The plot is shown next and it shows a fairly random pattern through time, with no apparent upward trend or other obvious time series pattern. </li></ul><ul><li>We can check that the MachHrs and ProdRuns also indicate no obvious pattern. </li></ul>
30. 30. Time Series Plot of Overhead versus Month
31. 31. The Scatterplots -- continued <ul><li>Finally, when multiple explanatory variables exist we can check for relationships between them. The scatterplot of MachHrs versus ProdRuns is a cloud of points that indicate no relationship worth pursuing. </li></ul>
32. 32. In Summary <ul><li>The Bendrix manager should continue to explore the positive relationship between Overhead and each of the MachHrs and ProdRuns variables. </li></ul><ul><li>However, none of the variables appear to have any time series behavior, and the two potential explanatory variables do not appear to be related to each other. </li></ul>
33. 33. Simple Linear Regression
34. 34. Background Information <ul><li>In Example 13.2 we created scatterplots for Bendrix. </li></ul><ul><li>We found that there was a positive relationship between Overhead and each of the MachHrs and ProdRuns variables. </li></ul><ul><li>However, none of the variables appear to have any time series behavior, and the two potential explanatory variables of MachHrs and ProdRuns do not appear to be related to each other. </li></ul>
35. 35. BENDRIX1.XLS <ul><li>The data collected by the manager appears in this file. </li></ul><ul><li>The Bendrix manufacturing data set has two explanatory variables, MachHrs and ProdRuns. </li></ul><ul><li>Eventually we will estimate a regression equation with both of the variables included. </li></ul><ul><li>However, if we include only one at a time, what do they tell us about the overhead costs? </li></ul>
36. 36. Regression Output for Overhead versus MachHrs
37. 37. Regression Output for Overhead versus ProdRuns
38. 38. Least Squares Line Equations <ul><li>The two least squares lines are therefore Predicted Overhead = 48,621 + 34.7MacHrs and Predicated Overhead = 75,606 + 655.1ProdRuns </li></ul><ul><li>Clearly these two equations are quite different, although each effectively breaks Overhead into a fixed component and a variable component. </li></ul><ul><li>The equations imply that expected overhead increases by about \$35 for each extra machine hour and about \$655 for each extra production run. </li></ul>
39. 39. Least Squares Line Equations -- continued <ul><li>The differences between these two lines can be attributed to neither one telling the whole story. </li></ul><ul><li>If the manager’s goal is to split overhead into a fixed and variable component, then the variable component should include both of the measures of work activity to give a more complete explanation of overhead. </li></ul><ul><li>We will see how this can be done using multiple regression at a later time. </li></ul>
40. 40. Multiple Regression
41. 41. Background Information <ul><li>In Example 13.2 we created scatterplots for Bendrix and in Example 13.2a we determined that the variable component of overhead must include both MachHrs and ProdRuns. </li></ul><ul><li>We found that there was a positive relationship between Overhead and each of the MachHrs and ProdRuns variables. </li></ul><ul><li>However, none of the variables appear to have any time series behavior, and the two potential explanatory variables of MachHrs and ProdRuns do not appear to be related to each other. </li></ul>
42. 42. BENDRIX1.XLS <ul><li>The data collected by the manager appear in this file. </li></ul><ul><li>The Bendrix manufacturing data set has two explanatory variables, MachHrs and ProdRuns. </li></ul><ul><li>We need to estimate and interpret the equation for Overhead when both explanatory variables, MachHrs and ProdRuns, are included in the regression equation. </li></ul>
43. 43. Solution <ul><li>To obtain the desired output we use StatPro/Regression Analysis/Multiple menu item. </li></ul><ul><li>We select Overhead as the response (dependent) variable and select MachHrs and ProdRuns as the explanatory (independent) variables. </li></ul><ul><li>The dialog box shown here then gives us options of which scatterplots to obtain and whether we want columns of fitted values and residuals placed next to the data set. For this example we will fill it in as shown. </li></ul>
44. 44. Solution -- continued <ul><li>The main regression output appears in the next table. </li></ul>
45. 45. Results <ul><li>The coefficients in the range C16-C18 indicate that the estimated regression equation is Predicted Overhead = 3997 + 43.45MachHrs + 883.62ProdRuns </li></ul>
46. 46. Interpretation of Equation <ul><li>The interpretation of the equation is that if the number of production runs is held constant, then the overhead cost is expected to increase by \$43.54 for each extra machine hour; and if the number of machine hours is held constant, the overhead is expected to increase by \$883.62 for each extra production run. </li></ul><ul><li>The Bendrix manager can interpret \$3997 as the fixed component of overhead. The slope terms involving MachHrs and ProdRuns are the variable components of overhead. </li></ul>
47. 47. Equation Comparison <ul><li>It is interesting to compare this equation with the separate equations found in the previous example: Predicted Overhead = 48,621 + 34.7MacHrs and Predicated Overhead = 75,606 + 655.1ProdRuns </li></ul><ul><li>Note that both coefficients have increased. </li></ul><ul><li>Also, the intercept is now lower than either intercept in the single variable equation. </li></ul><ul><li>It is difficult to guess the changes that more explanatory variables will cause, but it is likely that changes will occur. </li></ul>
48. 48. Equation Comparison -- continued <ul><li>The reasoning for this is that when MachHrs is the only variable in the equation, we are obviously not holding ProdRuns constant - we are ignoring it - so in effect the coefficient 34.7 of MachHrs indicates the effect of MachHrs and the omitted ProdRuns on Overhead. </li></ul><ul><li>But when we include both variables, the coefficient of 43.5 of MachHrs indicates the effect of MachHrs only, holding ProdRuns constant. </li></ul><ul><li>Since the coefficients have different meanings , it is not surprising that we obtain different estimates. </li></ul>
49. 49. Modeling Possibilities
50. 50. BANK.XLS <ul><li>The Fifth National Bank of Springfield is facing a gender-discrimination suit. The charge is that its female employees receive substantially smaller salaries than its male employees. </li></ul><ul><li>The bank’s employee database is listed in this file. Here is a partial list of the data. </li></ul>
51. 51. Variables <ul><li>For each of the 208 employees, the data set includes the following variables: </li></ul><ul><ul><li>EducLev: education level, a categorical variable with categories 1 (finished high school), 2 (finished some college courses), 3 (obtianed a bachelor’s degree), 4 (took some graduate courses) and 5 (obtained a graduate degree) </li></ul></ul><ul><ul><li>JobGrade: a categorical variable indicating the current job level, the possible levels being from 1-6 (6 is highest) </li></ul></ul><ul><ul><li>YrHired: year employee was hired </li></ul></ul><ul><ul><li>YrBorn: year employee was born </li></ul></ul><ul><ul><li>Gender: a categorical variable with values “Female” and “Male” </li></ul></ul>
52. 52. Variables -- continued <ul><ul><li>YrsPrior: number of years of work experience at another bank prior to working at Fifth National </li></ul></ul><ul><ul><li>PCJob: a dummy variable with value 1 if the employee’s current job is computer-related and value 0 otherwise </li></ul></ul><ul><ul><li>Salary: current annual salary in thousands of dollars </li></ul></ul><ul><li>Do the data provide evidence that females are discriminated against in terms of salary? </li></ul>
53. 53. Naïve Approach <ul><li>A naïve approach to the problem is to compare the average salaries of the males and females. </li></ul><ul><li>The average of all salaries is \$39,922, the average female salary is \$37,210, and the average male salary is \$45,505. </li></ul><ul><li>The difference between the averages is statistically different. The females are definitely earning less, but perhaps there is a reason. </li></ul><ul><li>The question is whether the differences between the average salaries is still evident after taking other attributes into account. A perfect task for regression. </li></ul>