ECONOMICS 351* -- Stata 10 Tutorial 6. Stata 10 Tutorial 6

Similar documents
Interpreting Slope Coefficients in Multiple Linear Regression Models: An Example

Introduction to Dummy Variable Regressors. 1. An Example of Dummy Variable Regressors

The Multiple Classical Linear Regression Model (CLRM): Specification and Assumptions. 1. Introduction

Interval Estimation in the Classical Normal Linear Regression Model. 1. Introduction

Tests of Exclusion Restrictions on Regression Coefficients: Formulation and Interpretation

Chapter 9: Statistical Inference and the Relationship between Two Variables

Linear Regression Analysis: Terminology and Notation

Chapter 2 - The Simple Linear Regression Model S =0. e i is a random error. S β2 β. This is a minimization problem. Solution is a calculus exercise.

e i is a random error

Marginal Effects of Explanatory Variables: Constant or Variable? 1. Constant Marginal Effects of Explanatory Variables: A Starting Point

ECONOMICS 351*-A Mid-Term Exam -- Fall Term 2000 Page 1 of 13 pages. QUEEN'S UNIVERSITY AT KINGSTON Department of Economics

Dummy variables in multiple variable regression model

β0 + β1xi. You are interested in estimating the unknown parameters β

ECON 351* -- Note 23: Tests for Coefficient Differences: Examples Introduction. Sample data: A random sample of 534 paid employees.

Statistics MINITAB - Lab 2

Econ107 Applied Econometrics Topic 3: Classical Model (Studenmund, Chapter 4)

Marginal Effects in Probit Models: Interpretation and Testing. 1. Interpreting Probit Coefficients

Lecture Notes for STATISTICAL METHODS FOR BUSINESS II BMGT 212. Chapters 14, 15 & 16. Professor Ahmadi, Ph.D. Department of Management

Comparison of Regression Lines

Chapter 13: Multiple Regression

x i1 =1 for all i (the constant ).

β0 + β1xi. You are interested in estimating the unknown parameters β

Tests of Single Linear Coefficient Restrictions: t-tests and F-tests. 1. Basic Rules. 2. Testing Single Linear Coefficient Restrictions

STAT 3008 Applied Regression Analysis

SIMPLE LINEAR REGRESSION

Chapter 14 Simple Linear Regression

[The following data appear in Wooldridge Q2.3.] The table below contains the ACT score and college GPA for eight college students.

ECONOMICS 452* -- Stata 9 Tutorial 6. Stata 9 Tutorial 6. TOPIC: Estimating and Interpreting Probit Models with Stata: Introduction

Resource Allocation and Decision Analysis (ECON 8010) Spring 2014 Foundations of Regression Analysis

January Examinations 2015

since [1-( 0+ 1x1i+ 2x2 i)] [ 0+ 1x1i+ assumed to be a reasonable approximation

Econ Statistical Properties of the OLS estimator. Sanjaya DeSilva

III. Econometric Methodology Regression Analysis

Correlation and Regression. Correlation 9.1. Correlation. Chapter 9

Economics 130. Lecture 4 Simple Linear Regression Continued

Chapter 11: Simple Linear Regression and Correlation

Lecture 3 Stat102, Spring 2007

Lecture 6: Introduction to Linear Regression

Introduction to Regression

Negative Binomial Regression

Psychology 282 Lecture #24 Outline Regression Diagnostics: Outliers

NUMERICAL DIFFERENTIATION

This column is a continuation of our previous column

The Ordinary Least Squares (OLS) Estimator

Outline. Zero Conditional mean. I. Motivation. 3. Multiple Regression Analysis: Estimation. Read Wooldridge (2013), Chapter 3.

ANSWERS. Problem 1. and the moment generating function (mgf) by. defined for any real t. Use this to show that E( U) var( U)

ECONOMETRICS - FINAL EXAM, 3rd YEAR (GECO & GADE)

Here is the rationale: If X and y have a strong positive relationship to one another, then ( x x) will tend to be positive when ( y y)

1. Inference on Regression Parameters a. Finding Mean, s.d and covariance amongst estimates. 2. Confidence Intervals and Working Hotelling Bands

Statistics II Final Exam 26/6/18

More metrics on cartesian products

LECTURE 9 CANONICAL CORRELATION ANALYSIS

Linear Approximation with Regularization and Moving Least Squares

Statistics for Managers Using Microsoft Excel/SPSS Chapter 13 The Simple Linear Regression Model and Correlation

/ n ) are compared. The logic is: if the two

Biostatistics 360 F&t Tests and Intervals in Regression 1

Properties of Least Squares

Chapter 14 Simple Linear Regression Page 1. Introduction to regression analysis 14-2

Lecture 9: Linear regression: centering, hypothesis testing, multiple covariates, and confounding

Lecture 9: Linear regression: centering, hypothesis testing, multiple covariates, and confounding

APPENDIX 2 FITTING A STRAIGHT LINE TO OBSERVATIONS

Basically, if you have a dummy dependent variable you will be estimating a probability.

Limited Dependent Variables

STAT 3340 Assignment 1 solutions. 1. Find the equation of the line which passes through the points (1,1) and (4,5).

Midterm Examination. Regression and Forecasting Models

Chapter 8 Indicator Variables

a. (All your answers should be in the letter!

F8: Heteroscedasticity

Kernel Methods and SVMs Extension

LINEAR REGRESSION ANALYSIS. MODULE VIII Lecture Indicator Variables

Diagnostics in Poisson Regression. Models - Residual Analysis

Laboratory 3: Method of Least Squares

Analytical Chemistry Calibration Curve Handout

Linear Feature Engineering 11

Department of Quantitative Methods & Information Systems. Time Series and Their Components QMIS 320. Chapter 6

x yi In chapter 14, we want to perform inference (i.e. calculate confidence intervals and perform tests of significance) in this setting.

n α j x j = 0 j=1 has a nontrivial solution. Here A is the n k matrix whose jth column is the vector for all t j=0

Statistics for Business and Economics

Number of cases Number of factors Number of covariates Number of levels of factor i. Value of the dependent variable for case k

Statistics for Economics & Business

Learning Objectives for Chapter 11

Lab 4: Two-level Random Intercept Model

Chapter 15 - Multiple Regression

THE ROYAL STATISTICAL SOCIETY 2006 EXAMINATIONS SOLUTIONS HIGHER CERTIFICATE

Module Contact: Dr Susan Long, ECO Copyright of the University of East Anglia Version 1

Question 1 carries a weight of 25%; question 2 carries 20%; question 3 carries 25%; and question 4 carries 30%.

CALCULUS CLASSROOM CAPSULES

MA 323 Geometric Modelling Course Notes: Day 13 Bezier Curves & Bernstein Polynomials

Lecture 19. Endogenous Regressors and Instrumental Variables

where I = (n x n) diagonal identity matrix with diagonal elements = 1 and off-diagonal elements = 0; and σ 2 e = variance of (Y X).

Chapter 7 Generalized and Weighted Least Squares Estimation. In this method, the deviation between the observed and expected values of

DO NOT OPEN THE QUESTION PAPER UNTIL INSTRUCTED TO DO SO BY THE CHIEF INVIGILATOR. Introductory Econometrics 1 hour 30 minutes

STAT 405 BIOSTATISTICS (Fall 2016) Handout 15 Introduction to Logistic Regression

Chapter 3. Two-Variable Regression Model: The Problem of Estimation

Econometrics: What's It All About, Alfie?

Difference Equations

Chapter 6. Supplemental Text Material

Y = β 0 + β 1 X 1 + β 2 X β k X k + ε

28. SIMPLE LINEAR REGRESSION III

ANOVA. The Observations y ij

Transcription:

ECONOMICS 35* -- Stata Tutoral 6 Stata Tutoral 6 TOPICS: Functonal Form and Varable Re-scalng n Smple Lnear Regresson Models, and An Introducton to Multple Lnear Regresson Models DATA: auto.dta (a Stata-format data fle) TASKS: Stata Tutoral 6 has three prmary purposes: () to ntroduce you to some of the alternatve functonal forms commonly used n lnear-n-coeffcents regresson models; (2) to nvestgate how varable re-scalng that s, changng the unts of measurement for Y and/or X affects OLS estmates of the slope coeffcent β and the ntercept coeffcent β n a smple lnear regresson equaton; and (3) to ntroduce you to OLS estmaton of multple lnear regresson models wth two or more regressors, n partcular, to demonstrate how the slope coeffcent estmates n a multple lnear regresson model are nterpreted. The Stata commands that consttute the prmary subject of ths tutoral are: regress Used to perform OLS estmaton of smple and multple lnear regresson models. predct Computes estmated Y -values and OLS resduals. graph twoway Draws scatterplots of sample data ponts and lne graphs of OLS sample regresson functons. lncom Used after estmaton to compute lnear combnatons of coeffcent estmates and assocated statstcs. NOTE: Stata commands are case senstve. All Stata command names must be typed n the Command wndow n lower case letters. LEARNING FROM THIS TUTORIAL: Stata Tutoral 6 contans some mportant analytcal results. You should make sure you understand them. ECON 35* -- Fall 28: Stata Tutoral 6 Page of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Preparng for Your Stata Sesson Before begnnng your Stata sesson, use Wndows Explorer to copy the Stataformat dataset auto.dta to the Stata workng drectory on the C:-drve or D:-drve of the computer at whch you are workng. On the computers n Dunnng 35, the default Stata workng drectory s usually C:\data. On the computers n MC B, the default Stata workng drectory s usually D:\courses. Start Your Stata Sesson To start your Stata sesson, double-clck on the Stata con n the Wndows desktop. After you double-clck the Stata con, you wll see the now famlar screen of four Stata wndows. Record Your Stata Sesson log usng To record your Stata sesson, ncludng all the Stata commands you enter and the results (output) produced by these commands, make a.log fle named 35tutoral6.log. To open (begn) the.log fle 35tutoral6.log, enter n the Command wndow: log usng 35tutoral6.log Ths command opens a fle called 35tutoral6.log n the current Stata workng drectory. Remember that once you have opened the 35tutoral6.log fle, a copy of all the commands you enter durng your Stata sesson and of all the results they produce s recorded n that 35tutoral6.log fle. An alternatve way to open the.log fle 35tutoral6.log s to clck on the Log button; clck on Save as type: and select Log (*.log); clck on the Fle name: box and type the fle name 35tutoral6; and clck on the Save button. ECON 35* -- Fall 28: Stata Tutoral 6 Page 2 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Loadng a Stata-Format Dataset nto Stata use Load, or read, nto memory the dataset you are usng. To load the Stata-format data fle auto.dta nto memory, enter n the Command wndow: use auto Ths command loads nto memory the Stata-format dataset auto.dta. Famlarze Yourself wth the Current Dataset To famlarze (or re-famlarze) yourself wth the contents of the current dataset, type n the Command wndow the followng commands: descrbe summarze Alternatve Functonal Forms for the Smple Lnear Regresson Model Ths secton demonstrates () how to estmate by OLS dfferent functonal forms for the smple lnear regresson model relatng car prce (prce ) to car weght (weght ), (2) how to use the predct command to compute estmated or predcted values of the regressand ( $Y -values) for the sample observatons, and (3) how to use the graph twoway command to dsplay the OLS sample regresson functon correspondng to the observed sample values of the regressor weght.. The LIN-LIN (Lnear) Model: Ths model take the general form Y β + β X + u (a) Settng Y prce and X weght, PRE (a) takes the specfc form prce β + β weght + u (b) To estmate ths model (agan!) by OLS for the full sample of observatons n dataset auto.dta, and to calculate the estmated (or predcted) values of prce ECON 35* -- Fall 28: Stata Tutoral 6 Page 3 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 for the sample observatons, enter n the Command wndow the followng commands: regress prce weght predct yhat The yhat varable created by the predct command takes the form Ŷ prîce βˆ + βˆ X βˆ + βˆ weght (,..., N) (c) where ˆβ and are the OLS coeffcent estmates for the LIN-LIN model. $ β To make a scatterplot of the sample data ( Y, X ) (prce, weght ) and a lne graph of the OLS sample regresson functon (c), frst sort the sample data by weght and then use the followng graph twoway command: sort weght graph twoway scatter prce weght lne yhat weght, yttle("car prce (U.S. dollars)," "observed and estmated") xttle("car weght (pounds)") ttle("lin-lin Model of Car Prce on Car Weght") subttle("ols Regresson Lne and Scatterplot of Sample Data") legend(label( "Sample data ponts") label(2 "Sample regresson lne")) Ths command nstructs Stata to draw on the same set of coordnate axes both () a scatterplot of the sample data ponts (Y, X ) (prce, weght ) and (2) a lne graph of the estmated values of prce (.e., yhat Ŷ prîce ) aganst the sample values of weght,.e, of the ponts ( Y $, X). Note that weght s the varable measured on the horzontal X-axs, and both prce and yhat are measured on the vertcal Y-axs. 2. The LOG-LOG (Double-Log) Model: Ths model takes the general form ln Y α + α ln X + u (2a) where lny s the natural logarthm of Y and lnx s the natural logarthm of X. ECON 35* -- Fall 28: Stata Tutoral 6 Page 4 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Settng ln Y ln( prce) and lnx ln( weght ), PRE (2a) takes the specfc form ln( prce ) α + α ln(weght ) + u, (2b) where ln( prce ) the natural logarthm of the varable prce ; ln( weght ) the natural logarthm of the varable weght. Note: The natural logarthm s defned only for varables that take only postve values. Ths s the case for both prce and weght n the dataset auto.dta. Before estmatng the LOG-LOG model (2), you must generate the natural logarthms of the varables prce and weght. Use the followng Stata generate commands to do ths. generate lnprce ln(prce) generate lnweght ln(weght) summarze lnprce lnweght To estmate the LOG-LOG model by OLS for the full sample of observatons and to calculate the estmated (or predcted) values of ln(prce ) for the sample observatons, enter n the Command wndow: regress lnprce lnweght predct lnyhatdl The lnyhatdl varable created by the predct command takes the form lnˆ Y ln(prîce ) αˆ + αˆ ln X αˆ + αˆ ln(weght ) (,..., N) (2c) where ˆα and $α are the OLS coeffcent estmates for the LOG-LOG model and l$ny n( $ l prce) denotes the predcted values of lny. ECON 35* -- Fall 28: Stata Tutoral 6 Page 5 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 To make a scatterplot of the sample data (lny, lnx ) and a lne graph of the OLS sample regresson functon (2c), use the followng graph twoway command: graph twoway scatter lnprce lnweght lne lnyhatdl lnweght, yttle("ln(prce)," "observed and estmated") xttle("ln(weght)") ttle("log-log Model of Car Prce on Car Weght") subttle("ols Regresson Lne and Scatterplot of Sample Data") legend(label( "Sample data ponts") label(2 "Sample regresson lne")) 3. The LOG-LIN (Sem-Log) Model: Ths model takes the general form ln Y γ + γ X + u (3a) Settng l n Y ln( prce ) and X weght, PRE (3a) takes the specfc form ln( prce ) γ + γ weght + u (3b) To estmate the LOG-LIN model by OLS for the full sample of observatons and to calculate the estmated (or predcted) values of ln(prce ) for the sample observatons, type n the Command wndow: regress lnprce weght predct lnyhatsl The lnyhatsl varable created by the predct command takes the form lnˆ Y ln(prîce ) γˆ + γˆ X γˆ + γˆ weght (,..., N) (3c) where ˆγ and $γ are the OLS coeffcent estmates for the LOG-LIN model and l$ ny n( rc $ l p e) denotes the predcted values of lny. ECON 35* -- Fall 28: Stata Tutoral 6 Page 6 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 To make a scatterplot of the sample data (lny, X ) and a graph of the OLS sample regresson functon (3c), use the followng graph twoway command: graph twoway scatter lnprce weght lne lnyhatsl weght, yttle("ln(car prce)," "observed and estmated") xttle("car weght (pounds)") ttle("log-lin Model of Car Prce on Car Weght") subttle("ols Regresson and Scatterplot of Sample Data") legend(label( "Sample data ponts") label(2 "Sample regresson lne")) Unts of Measurement and Re-scalng of Varables n Smple Regresson Models The coeffcent estmates n lnear (LIN-LIN) regresson models depend on the unts of measurement for the dependent varable Y and the ndependent varable X. Ths secton presents some analytcal results on how changng unts of measurement for Y and/or X affects the OLS estmates of the slope coeffcent β and the ntercept coeffcent β n a smple lnear regresson equaton. It then llustrates these results wth a smple lnear regresson model. Analyss: (There are no Stata commands n ths secton.) The term "re-scalng a varable" means multplyng that varable by a constant; ths s what happens when we change the unts n whch a varable s measured. Wrte the orgnal regresson equaton, expressed n terms of the orgnal varables Y and X, as equaton (4): Y β + β X + u. (4) Re-scale the orgnal varables Y and X by multplyng each by some arbtrarlyselected constant. Create the re-scaled varable X& by multplyng X by the constant c: X & cx (,, N), where c s a specfed constant. ECON 35* -- Fall 28: Stata Tutoral 6 Page 7 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Smlarly, create the re-scaled varable Y& by multplyng Y by the constant d: Y & dy (,, N), where d s a specfed constant. The new regresson equaton wrtten n terms of the re-scaled varables can be wrtten as: X& and Y& Y & X& + u&. (5) β + β Questons: How s the OLS estmate of the slope coeffcent OLS estmate of β n equaton (4)? How s the OLS estmate of the ntercept coeffcent the OLS estmate of β n equaton (4)? Answers: β n equaton (5) related to the β n equaton (5) related to The formula for the OLS estmator of β n the orgnal equaton (4) s: β ˆ xy 2 x where x X X and y Y Y (,, N). The formula for the OLS estmator of β n the orgnal equaton (4) s: β ˆ Y ˆ X where Y Y N and X X N. β The formula for the OLS estmator of β n the re-scaled equaton (5) s: β ˆ x& y& 2 x& where x& X& X& and y& Y& Y& (,, N). (6) To see how the new slope coeffcent estmator βˆ s related to the orgnal slope coeffcent estmator ˆβ, we need to determne how the re-scaled devatons-from- ECON 35* -- Fall 28: Stata Tutoral 6 Page 8 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 means varables x& X& X& and y& Y& Y& are related to the orgnal devatons-from-means varables x X X and y Y Y. Here s the algebra: X & cx X & cx x & X& X& cx cx c(x X) cx ; Y & dy Y & dy y & Y& Y& dy dy d(y Y) dy. Thus, we see that x & cx and mply the followng results: y & dy (,, N). These two equaltes n turn x & y& cx dy cdx y x & y& cd x y ; 2 2 2 2 2 2 2 x & (cx ) c x x& c x. Now substtute these results nto expresson (6) for βˆ : βˆ x& y& x& 2 cd c 2 x y x 2 d c x y x 2 d βˆ. c The formula for the OLS estmator of β n the re-scaled equaton (5) s: β ˆ Y& ˆ X&. (7) β To see how the new ntercept coeffcent estmator βˆ s related to the orgnal ntercept coeffcent estmator ˆβ, substtute nto expresson (7) for βˆ the d prevous results showng that ˆβ ˆ β, Y & dy and X & cx : c β ˆ Y& βˆ X& dy d βˆ c cx dy dˆ β X d(y βˆ X) dˆ β. ECON 35* -- Fall 28: Stata Tutoral 6 Page 9 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Results: d β ˆ ˆ β βˆ s affected by the re-scalng of both Y and X. (8) c β ˆ dˆ β ˆ s affected only by the re-scalng of Y. (9) β Some Examples To llustrate the effects of varable re-scalng.e., of changng the unts of measurement for Y and/or X we nvestgate how changng the unts of measurement for the varables n regresson equaton () affect the OLS coeffcent estmates. For convenence, the orgnal equaton () s rewrtten here as: prce β + β weght + u () where prce car prce measured n US dollars and weght car weght measured n pounds. Frst, re-estmate by OLS the LIN-LIN model gven by regresson equaton () and save as scalars the OLS coeffcent estmates βˆ and βˆ. Enter the commands: regress prce weght scalar beq _b[_cons] scalar beq _b[weght] scalar lst beq beq. Re-scale only the dependent varable. Re-scale the dependent varable prce so that t s measured n hundreds of US dollars nstead of US dollars. Generate the re-scaled prce varable newp car prce measured n hundreds of US dollars, where newp prce /. Enter the command: generate newp prce/ ECON 35* -- Fall 28: Stata Tutoral 6 Page of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Compare the sample values of the orgnal prce varable wth those of the rescaled prce varable newp. Enter the commands: summarze prce newp regress newp prce Estmate by OLS the regresson equaton wth newp as dependent varable and weght as the ndependent varable. Use scalar and dsplay commands to save the resultng OLS coeffcent estmates and compare them wth the coeffcent estmates for the baselne model gven by PRE (). Enter the commands: regress newp weght scalar beq2 _b[_cons] scalar beq2 _b[weght] scalar lst beq beq2 beq beq2 dsplay beq2/beq dsplay beq2/beq Carefully compare the results of ths command wth those from OLS estmaton of the orgnal regresson equaton (). Whch results have changed as a result of re-scalng only the dependent varable? 2. Re-scale only the ndependent varable. Re-scale the ndependent varable weght so that t s measured n klograms nstead of pounds, where klogram 2.2 pounds. Generate the re-scaled weght varable neww car weght measured n klograms, where neww weght /2.2. Enter the command: generate neww weght/2.2 Compare the sample values of the orgnal weght varable wth those of the rescaled weght varable neww. Enter the commands: summarze weght neww regress neww weght regress weght neww ECON 35* -- Fall 28: Stata Tutoral 6 Page of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Estmate by OLS the regresson equaton wth prce as dependent varable and neww as the ndependent varable. Use scalar and dsplay commands to save the resultng OLS coeffcent estmates and compare them wth the coeffcent estmates for the baselne model gven by PRE (). Enter the commands: regress prce neww scalar beq3 _b[_cons] scalar beq3 _b[neww] scalar lst beq beq3 beq beq3 dsplay beq3/beq dsplay beq3/beq Carefully compare the results of ths command wth those from OLS estmaton of the orgnal regresson equaton (). Whch results have changed as a result of re-scalng only the ndependent varable? 3. Re-scale both the dependent varable and the ndependent varable. Re-scale both the dependent varable prce and the ndependent varable weght as above. The re-scaled dependent varable s newp car prce measured n hundreds of US dollars, where newp prce /. The re-scaled ndependent varable s neww car weght measured n klograms, where neww weght /2.2. Estmate by OLS the regresson equaton wth newp as dependent varable and neww as the ndependent varable. Use scalar and dsplay commands to save the resultng OLS coeffcent estmates and compare them wth the coeffcent estmates for the baselne model gven by PRE (). Enter the commands: regress newp neww scalar beq4 _b[_cons] scalar beq4 _b[neww] scalar lst beq beq4 beq beq4 dsplay beq4/beq dsplay beq4/beq Carefully compare the results of ths command wth those from OLS estmaton of the orgnal regresson equaton (). Whch results have changed as a result of re-scalng both the dependent and ndependent varables? ECON 35* -- Fall 28: Stata Tutoral 6 Page 2 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Interpretng Slope Coeffcents n Multple Lnear Regresson Models In ths secton, we ntroduce you to the use of the Stata regress command to compute OLS estmates of multple lnear regresson equatons that contan two or more regressors. The mechancs of usng the regress command for estmatng multple lnear regresson models are a straghtforward extenson of those for estmatng smple lnear regresson models. Ths secton therefore focuses more on how the nterpretaton of slope coeffcent estmates n multple lnear regresson models dffers from the nterpretaton of slope coeffcent estmates n smple lnear regresson models. Consder two dfferent lnear regresson models for car prce, prce. Model s the smple lnear regresson model gven by populaton regresson equaton (.) and the correspondng populaton regresson functon (.2): prce β + β weght + u (.) E ( prce weght ) β + βweght (.2) Model 2 s the multple lnear regresson model gven by populaton regresson equaton (.) and the correspondng populaton regresson functon (.2): prce β + β weght + β mpg + u (.) E ( prce weght, mpg ) β + βweght + β2mpg 2 (.2) Queston: How does the slope coeffcent β n the smple lnear regresson model gven by equatons (.) and (.2) dffer from the slope coeffcent β n the multple lnear regresson model 2 gven by equatons (.) and.2)? Analytcal Answer The slope coeffcent β n the smple lnear regresson model gven by equatons (.) and (.2) s the unadjusted or total margnal effect of car weght on mean car prce, because PRE (.) and PRF (.2) do not account for, or control for, the effects on car prces of any other explanatory varables apart from weght. ECON 35* -- Fall 28: Stata Tutoral 6 Page 3 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Analytcally, ths means that the slope coeffcent β n the smple lnear regresson model (.)/ (.2) corresponds to the total dervatve of mean car prce wth respect to weght : d E ( prce weght ) d weght d ( β + β weght β n Model d weght the unadjusted or total margnal effect of weght on the mean prce of cars sold n North Amerca n 978 the change n mean car prce, n 978 US dollars, assocated wth a - pound ncrease n car weght In contrast, the slope coeffcent β n the multple lnear regresson model 2 gven by equatons (.) and (.2) s the adjusted or partal margnal effect of car weght on mean car prce, because PRE (.) and PRF (.2) account for, or control for, the effect on car prces of another explanatory varable apart from weght, namely cars fuel effcency as measured by mles-per-gallon mpg. Analytcally, ths means that the slope coeffcent β n the multple lnear regresson model (.)/ (.2) corresponds to the partal dervatve of mean car prce wth respect to weght : E ( prce weght, mpg ) weght ( β ) + βweght + β2mpg weght ) β n Model 2 the adjusted or partal margnal effect of weght on the condtonal mean prce of cars sold n North Amerca n 978 the change n condtonal mean car prce, n 978 US dollars, assocated wth a -pound ncrease n car weght, holdng constant the fuel effcency of cars as measured by mpg the change n condtonal mean car prce, n 978 US dollars, assocated wth a -pound ncrease n car weght for cars of the same fuel effcency. To llustrate the dfference between the slope coeffcent of weght n the smple lnear regresson model, Model, and the slope coeffcent of weght n the ECON 35* -- Fall 28: Stata Tutoral 6 Page 4 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 multple lnear regresson model, Model 2, we wll use the Stata regress command to compute OLS estmates of the two models. Interpretng the slope coeffcent estmate of weght n Model Wrte the OLS sample regresson functon (SRF) for Model as ~ prce ~ ~ β + β weght (.3) ~ ~ where β j denotes the OLS estmate of β j n Model, and prce s the OLS estmate of mean car prce gven by the populaton regresson functon (PRF) E( prce weght ) β + βweght for Model, the smple lnear regresson model gven by PRE (.) and PRF (.2). The OLS SRF (.3) for Model mples that the estmated change n mean car prce assocated wth a change n car weght of Δ weght s ~ ~ Δ prce βδweght (.4) In Model, the estmated effect on mean car prce of a -pound ncrease n car weght can be obtaned by settng Δ weght n equaton (.4): ~ Δ prce β ~ when Δ weght (.5) ~ The slope coeffcent estmate β n Model s therefore an estmate of the change n mean car prce assocated wth a -pound ncrease n weght, holdng constant no other explanatory varables that may be related to car prce. Interpretng the slope coeffcent estmate of weght n Model 2 Wrte the OLS sample regresson functon (SRF) for Model 2, obtaned by OLS estmaton of the multple lnear regresson equaton (.), as prîce βˆ + βˆ weght + βˆ mpg (.3) 2 ECON 35* -- Fall 28: Stata Tutoral 6 Page 5 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 where ˆβ j denotes the OLS estmate of β j n Model 2, and prîce s the OLS estmate of mean car prce gven by the populaton regresson functon (PRF) prce weght β + β weght + β mpg for Model 2, the multple lnear ( ) E 2 regresson model gven by PRE (.) and PRF (.2). The OLS SRF (.3) mples that the estmated change n mean car prce assocated wth a change n car weght of Δ weght and a smultaneous change n fuel effcency of Δ mpg s Δ prîce βˆ weght ˆ Δ + β2δmpg (.4) We can hold constant the fuel effcency of cars by settng Δ mpg n equaton (.4); the resultng change n estmated mean car prce s then Δ prîce βˆ Δweght when Δ mpg (.5) In Model 2, the estmated effect on mean car prce of a -pound ncrease n car weght when fuel effcency s held constant can be obtaned by settng Δweght n equaton (.5), or equvalently by settng Δ weght and Δmpg n equaton (.4): Δ prîce β ˆ when Δ weght and Δ mpg (.6) The slope coeffcent estmate ˆβ n Model 2 s therefore an estmate of the change n mean car prce assocated wth a -pound ncrease n weght, holdng constant fuel effcency as measured by mpg. The followng Stata exercses are desgned to llustrate the precedng analyss of ~ how the slope coeffcent estmate β n the smple lnear regresson model, Model, dffers from the slope coeffcent estmate ˆβ n the multple lnear regresson model, Model 2. It also llustrates the meanng of holdng constant other varables n multple lnear regresson models. These exercses also ntroduce you to an mportant post-estmaton Stata command, the lncom command. ECON 35* -- Fall 28: Stata Tutoral 6 Page 6 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Stata Exercse : Model Frst, estmate (agan!) by OLS the smple lnear regresson model, Model, on the full sample of observatons n dataset auto.dta. Enter n the Command wndow the followng regress command: regress prce weght Use a Stata lncom command to compute the estmated mean prce of a car that weghs 3, pounds (for whch weght 3),.e., to compute ~ ~ E ~ ( prce weght 3) β + β3. Enter the lncom command: lncom _b[_cons] + _b[weght]*3 Next, ncrease weght by pound, from 3, to 3, pounds. Use another Stata lncom command to compute the estmated mean prce of a car that weghs 3, pounds (for whch weght 3),.e., to compute ~ ~ E ~ ( prce weght 3) β + β3. Enter the lncom command: lncom _b[_cons] + _b[weght]*3 Fnally, use a Stata lncom command to compute the dfference between the estmated mean prce of a car that weghs 3, pounds and the estmated mean prce of a car that weghs 3, pounds,.e., to compute E ~ ( prce weght 3) ( prce weght 3) E ~. ~ ~ ~ ~ β + β3 ( β + β3). ~ ~ ~ β β + β (3 3). ~ β Enter on one lne the lncom command: lncom _b[_cons] + _b[weght]*3 - (_b[_cons] + _b[weght]*3) ECON 35* -- Fall 28: Stata Tutoral 6 Page 7 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Compare the output of ths last lncom command wth the coeffcent estmate ~ β for the regressor weght produced by the regress command used to estmate Model by OLS. You wll see that they are dentcal. Result of Exercse : We have demonstrated n ths exercse that the slope ~ coeffcent estmate β of the regressor weght n Model s an estmate of the total effect on mean car prce of a -pound ncrease n car weght when no other explanatory varables that mght affect car prce are held constant. Stata Exercse 2: Model 2 Estmate by OLS the multple lnear regresson model, Model 2, on the full sample of 74 observatons n dataset auto.dta. Enter n the Command wndow the followng regress command: regress prce weght mpg Use a Stata lncom command to compute for Model 2 the estmated mean prce of a car that weghs 3, pounds (for whch weght 3) and has fuel effcency equal to 2 mles per gallon (for whch mpg 2),.e., to compute Ê( prce weght 3, mpg 2) ˆ ˆ 3 ˆ β + β + β2 2. Enter the lncom command: lncom _b[_cons] + _b[weght]*3 + _b[mpg]*2 Next, ncrease weght by pound, from 3, to 3, pounds, whle holdng constant fuel effcency at a value of 2 mles-per-gallon. Use another Stata lncom command to compute for Model 2 the estmated mean prce of a car that weghs 3, pounds (for whch weght 3) and has fuel effcency equal to 2 mles per gallon (for whch mpg 2),.e., to compute Ê( prce weght 3, mpg 2) ˆ ˆ 3 ˆ β + β + β2 2. Note that we are holdng fuel effcency constant at mpg 2. Enter the lncom command: lncom _b[_cons] + _b[weght]*3 + _b[mpg]*2 Fnally, use a Stata lncom command to compute the dfference between () the estmated mean prce of a car that weghs 3, pounds and has fuel effcency of 2 mles-per-gallon and (2) the estmated mean prce of a car that ECON 35* -- Fall 28: Stata Tutoral 6 Page 8 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 weghs 3, pounds and has fuel effcency of 2 mles-per-gallon,.e., to compute Ê ( prce weght 3, mpg 2) Ê( prce weght 3, mpg 2) βˆ ˆ 3 ˆ 2 (ˆ ˆ 3 ˆ + β + β2 β + β + β2 2) βˆ β ˆ + βˆ 3+ βˆ 2 βˆ βˆ 3 ˆ 2 β2 ˆβ (3 3) 2 Enter on one lne the lncom command: lncom _b[_cons] + _b[weght]*3 + _b[mpg]*2 - (_b[_cons] + _b[weght]*3 + _b[mpg]*2) Compare the output of ths last lncom command wth the slope coeffcent estmate ˆβ for the regressor weght produced by the regress command used to estmate Model 2 by OLS. You wll see that they are dentcal. Result of Exercse 2: We have demonstrated n ths exercse that the slope coeffcent estmate β ˆ of the regressor weght n Model 2 s an estmate of the partal effect on mean car prce of a -pound ncrease n car weght when fuel effcency as measured by mpg s held constant at some fxed value. ECON 35* -- Fall 28: Stata Tutoral 6 Page 9 of 2 pages

ECONOMICS 35* -- Stata Tutoral 6 Preparng to End Your Stata Sesson Before you end your Stata sesson, you should do two thngs. Frst, you may want to save the current dataset (although you wll not need t for future tutorals). Enter the followng save command to save the current dataset as Stata-format dataset auto6.dta: save auto6 Second, close the.log fle you have been recordng. Enter the command: log close End Your Stata Sesson ext To end your Stata sesson, use the ext command. Enter the command: ext or ext, clear Cleanng Up and Clearng Out After returnng to Wndows, you should copy all the fles you have used and created durng your Stata sesson to your own dskette. These fles wll be found n the Stata workng drectory, whch s usually C:\data on the computers n Dunnng 35, and D:\courses on the computers n MC B. There s one fle you wll want to be sure you have: the Stata log fle 35tutoral6.log. If you saved the Stata-format data set auto6.dta, you wll probably want to take t wth you as well. Use the Wndows copy command to copy any fles you want to keep to your own portable electronc storage devce (e.g., flash memory stck) n the E:-drve. Fnally, as a courtesy to other users of the computng classroom, please delete all the fles you have used or created from the Stata workng drectory. ECON 35* -- Fall 28: Stata Tutoral 6 Page 2 of 2 pages