Stata 11 Tutorial 3 - Queen's U

Transcription

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. AbbottStata 11 Tutorial 3TOPIC: Modeling Marginal Effects of Continuous Explanatory Variables:Constant or Variable?DATA: auto1.dta(a Stata-format dataset first created in Stata 11 Tutorial 1)TASKS: Stata 11 Tutorial 3 examines two alternative specifications of a linearregression model containing two continuous explanatory variables: onerestricts the marginal effects of the two explanatory variables to be constants;the other allows the marginal effects of the two explanatory variables to bevariable. The first specification was explored in some depth in Stata 11Tutorial 2. The second specification of the model introduces variable marginaleffects by including as regressors polynomial terms and interaction terms inthe two continuous explanatory variables. A third model is used to investigatethe question of how many polynomial terms are needed to adequately representthe effect of the two continuous explanatory variables on the dependentvariable. The Stata commands that constitute the primary subject of this tutorial are:regresstestlincom Used to perform OLS estimation of multiple linear regressionmodels.Used to compute F-tests of linear coefficient equality restrictionsafter OLS estimation.Used after estimation to compute linear combinations ofcoefficient estimates and associated statistics.The Stata statistical functions used in this tutorial are:ttail(df, t0)invttail(df, p)Ftail(df1, df2, F0)invFtail(df1, df2, α)Computes right-tail p-values of calculated t-statisticsComputes right-tail critical values of t-distributionsComputes p-values of calculated F-statisticsComputes critical values of F-distributionsNOTE: Stata commands are case sensitive. All Stata command names must be typedin the Command window in lower case letters.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 1 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottPreparing for Your Stata SessionBefore beginning your Stata session, use Windows Explorer to copy the Stata-formatdata set auto1.dta to the Stata working directory on the C:-drive or D:-drive of thecomputer at which you are working. On the computers in Dunning 350, the default Stata working directory is usuallyC:\data. On the computers in MC B111, the default Stata working directory is usuallyD:\courses. Start Your Stata SessionTo start your Stata session, double-click on the Stata 11 or Stata 12 icon on theWindows desktop.After you double-click the Stata 11 or Stata 12 icon, you will see the familiar screenof four Stata windows (or five Stata windows if you are using Stata 12). Record Your Stata Session – log usingTo record your Stata session, including all the Stata commands you enter and theresults (output) produced by these commands, make a text-format .log file named452tutorial3.log. To open (begin) the log file 452tutorial3.log, enter in theCommand window:log using 452tutorial3.logThis command opens a text-format (ASCII) file called 452tutorial3.log in the currentStata working directory.Note: It is important to include the .log file extension when opening a log file; if youdo not, your log file will be in smcl format, a format that only Stata can read. Onceyou have opened the 452tutorial3.log file, a copy of all the commands you enterduring your Stata session and of all the results they produce is recorded in that452tutorial3.log file.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 2 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. AbbottAn alternative way to open (start) a text-format log file is to use the Log button inthe button bar near the top of the Stata window.The following steps would replicate what the above log using command does. Click on the Log button in the button bar near the top of the Stata window; thisopens the Begin Logging Stata Output dialog box. In the Begin Logging Stata Output dialog box: click on Save as type: and select Log (*.log);click on the File name: box and type the file name 452tutorial3;click on the Save button.Load a Stata-Format Dataset into Stata – useLoad, or read, into memory the data set you are using. To load the Stata-formatdata file auto1.dta into memory, enter in the Command window:use auto1This command loads into memory the Stata-format data set auto1.dta. Familiarize Yourself with the Current Data SetTo familiarize (or re-familiarize) yourself with the contents of the current dataset, type in the Command window the following commands:describe, shortdescribesummarizelist price wgt mpgECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 3 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottA Linear Regression Model with Constant Marginal EffectsNature: A linear regression equation in which the continuous explanatory variablesenter only linearly exhibits constant marginal effects.Consider the following generic linear regression equation in the two continuousexplanatory variables X1 and X2:Yi β 0 β1X i1 β 2 X i 2 u i .(1)Formally, the population regression function E ( Yi X i1 , X i 2 ) f ( X i1 , X i 2 ) in PRE(1) can be derived as a first-order Taylor series approximation to the functionf ( X i1 , X i 2 ) .Compare the marginal effects on Y of the two explanatory variables X1 and X2 inequation (1). The marginal effect of X1 in equation (1) is: E ( Yi X i1 , X i 2 ) Yi β1 a constant X i1 X i1 The marginal effect of X2 in equation (1) is: E ( Yi X i1 , X i 2 ) Yi β 2 a constant Xi2 Xi2In other words, the slope coefficients of X1 and X2 in equation (1) equal thecorresponding marginal effects of the two explanatory variables.Example: An example of the generic regression model (1) is the followingpopulation regression equation for North American car prices:Model 1:price i β 0 β1wgt i β 2 mpg i u iECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.doc(2)Page 4 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. Abbottwhereprice i the price of the i-th car (in US dollars);wgt i the weight of the i-th car (in pounds);mpg i the miles per gallon (fuel efficiency) for the i-th car (in milesper gallon). To estimate by OLS the linear regression model given by PRE (2), enter in theCommand window the following regress command:regress price wgt mpg Test 1: Test the hypothesis that the marginal effect of wgti on pricei is zero inregression equation (2). Use Stata commands to demonstrate that an F-test and atwo-tail t-test of this hypothesis are equivalent. The marginal effect of wgti on pricei in Model 1 is obtained by partiallydifferentiating regression equation (2) with respect to wgti. E ( price i wgt i , mpg i ) price i β1 wgt i wgt i The null and alternative hypotheses are therefore:H 0: β 1 0H1: β1 0. The following test command computes an F-test of H0 against H1. The returnlist command displays the temporarily saved results of the test command. Enterthe commands:test wgtreturn listInspect the results generated by these commands. State the inference you woulddraw from this test.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 5 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottUse a scalar command to save the sample value of the F-statistic for β̂1 , denotedanalytically as F (βˆ ) , and display the value of F (βˆ ) and its p-value. Enter the0101commands:scalar Fb1 r(F)scalar list Fb1display Ftail(1, 71, Fb1) The following lincom command computes a two-tail t-test of H0 against H1.Enter the commands:lincom b[wgt]return listInspect the results generated by these commands. State the inference you woulddraw from this test. Use a scalar command to save the sample value of the t-statistic for β̂1 , denotedanalytically as t (βˆ ) , and display the value of t (βˆ ) and its two-tail p-value0101(computed in two different ways). Enter the commands:scalar tb1 r(estimate)/r(se)scalar list tb1display 2*ttail(71, abs(tb1))display 2*ttail(r(df), abs(r(estimate)/r(se))) Compare the results of the F-test and two-tail t-test of H0 against H1. This can bedone in either of two equivalent ways. First, show that the sample values of thetest statistics, F0 (βˆ 1 ) and t 0 (βˆ 1 ) , are related as follows:F0 (βˆ 1 ) t 0 (βˆ 1 ) 2 .Since F0 (βˆ 1 ) and t 0 (βˆ 1 ) 2 have the same null distribution, namely the F[1,71]distribution, it follows that they have the same p-value. Enter the commands:scalar tb1sq tb1 2scalar list Fb1 tb1sqECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 6 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. Abbottdisplay Ftail(1, 71, Fb1)display Ftail(1, 71, tb1sq)You should be able to see from the results of these commands that the F-test andtwo-tail t-test of H0: β1 0 against H1: β1 0 are equivalent, meaning they yieldidentical inferences. A second way to demonstrate the equivalence of the F-test and two-tail t-test of H0against H1 is to show that the sample values of the test statistics, F0 (βˆ 1 ) andt (βˆ ) , are related as follows:01t 0 (βˆ 1 ) F0 (βˆ 1 ) .Since t 0 (βˆ 1 ) and F0 (βˆ 1 ) have the same null distribution, namely the t[71]distribution, it follows that they have the same p-value. Enter the commands:scalar sqrtFb1 sqrt(Fb1)scalar list tb1 sqrtFb1display 2*ttail(71, abs(tb1))display 2*ttail(71, abs(sqrtFb1))Again, you should be able to see from the results of these commands that the Ftest and two-tail t-test of H0: β1 0 against H1: β1 0 are equivalent, meaning theyyield identical inferences. Test 2: Test the hypothesis that the marginal effect of mpgi on pricei is zero inregression equation (2). Use Stata commands to demonstrate that an F-test and atwo-tail t-test of this hypothesis are equivalent. The marginal effect of mpgi on pricei in Model 1 is obtained by partiallydifferentiating regression equation (2) with respect to mpgi. E ( price i wgt i , mpg i ) price i β2 mpg i mpg iECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 7 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottThe null and alternative hypotheses are therefore:H 0: β 2 0H1: β2 0. The following test command computes an F-test of H0 against H1. The returnlist command displays the temporarily saved results of the test command. Enterthe commands:test mpgreturn listWhat inference would you draw from the generated results of this test? Use a scalar command to save the sample value of the F-statistic for β̂2 , denotedanalytically as F (βˆ ) , and display the value of F (βˆ ) and its p-value. Enter the0202commands:scalar Fb2 r(F)scalar list Fb2display Ftail(1, 71, Fb2) The following lincom command computes a two-tail t-test of H0 against H1.Enter the commands:lincom b[mpg]return listInspect the results generated by these commands. State the inference you woulddraw from this test. Use a scalar command to save the sample value of the t-statistic for β̂2 , denotedanalytically as t (βˆ ) , and display the value of t (βˆ ) and its two-tail p-value.0202Enter the commands:scalar tb2 r(estimate)/r(se)scalar list tb2display 2*ttail(71, abs(tb2))ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 8 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottCompare the results of the F-test and two-tail t-test of H0 against H1. This can bedone in either of two equivalent ways. First, show that the sample values of thetest statistics, F0 (βˆ 2 ) and t 0 (βˆ 2 ) , are related as follows:F0 (βˆ 2 ) t 0 (βˆ 2 ) 2 .Since F0 (βˆ 2 ) and t 0 (βˆ 2 ) 2 have the same null distribution, namely the F[1,71]distribution, it follows that they have the same p-value. Enter the commands:scalar tb2sq tb2 2scalar list Fb2 tb2sqdisplay Ftail(1, 71, Fb2)display Ftail(1, 71, tb2sq)You should be able to see from the results of these commands that the F-test andtwo-tail t-test of H0: β2 0 against H1: β2 0 are equivalent, meaning they yieldidentical inferences. A second way to demonstrate the equivalence of the F-test and two-tail t-test of H0against H1 is to show that the sample values of the test statistics, F0 (βˆ 2 ) andt (βˆ ) , are related as follows:02t 0 (βˆ 2 ) F0 (βˆ 2 ) .Since t 0 (βˆ 2 ) and F0 (βˆ 2 ) have the same null distribution, namely the t[71]distribution, it follows that they should have the same p-value. Enter thecommands:scalar sqrtFb2 sqrt(Fb2)scalar list tb2 sqrtFb2display 2*ttail(71, abs(tb2))display 2*ttail(71, abs(sqrtFb2))Again, you should be able to see from the results of these commands that the Ftest and two-tail t-test of H0: β2 0 against H1: β2 0 are equivalent, meaning theyyield identical inferences.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 9 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottInteraction Variables: Squares and Cross Products of Continuous VariablesYield Variable Marginal EffectsNature: Interactions between two continuous variables refer to products ofexplanatory variables. For example, if Xij and Xih are two continuous explanatoryvariables, the interaction term between them is the product XijXih. Alternatively,the interaction of the variable Xij with itself is simply the product X ij X ij X ij2 .Inclusion of these regressors in a linear regression model allows for nonconstantmarginal effects of the explanatory variables on the conditional mean of thedependent variable Y.Usage: Interaction terms between continuous variables allow the marginal effect ofone explanatory variable to be a linear function of both itself and the otherexplanatory variable.Consider the following generic linear regression equation:Yi β 0 β1X i1 β 2 X i 2 β3 X i21 β 4 X i22 β5 X i1X i 2 u i .(3)Formally, the population regression function E ( Yi X i1 , X i 2 ) f ( X i1 , X i 2 ) in PRE(3) can be derived as a second-order Taylor series approximation to the functionf ( X i1 , X i 2 ) .Compare the marginal effects on Y of the two explanatory variables X1 and X2 inequation (3). The marginal effect of X1 in equation (3) is: E ( Yi X i1 , X i 2 ) Yi β1 2β3 X i1 β5 X i 2 X i1 X i1 a linear function of both Xi1 and Xi2ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 10 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottThe marginal effect of X2 in equation (3) is: E ( Yi X i1 , X i 2 ) Yi β 2 2β 4 X i 2 β5 X i1 Xi2 Xi2 a linear function of both Xi1 and Xi2Example: An example of the generic regression model (3) is the followingpopulation regression equation for North American car prices:Model 2:price i β 0 β1wgt i β 2 mpg i β3 wgt i2 β 4 mpg i2 β5 wgt i mpg i u i .(4)whereprice i the price of the i-th car (in US dollars);wgt i the weight of the i-th car (in pounds);wgt i2 the square of wgt i for the i-th car;mpg i the miles per gallon (fuel efficiency) for the i-th car (in miles pergallon);2mpg i the square of mpg i for the i-th car;wgt i mpg i the product (interaction) of wgt i and mpg i for the i-th car. Before estimating regression equation (4), it is necessary to create the last threeregressors in PRE (4), namely the squared terms wgt i2 and mpg i2 , and theinteraction term wgt i mpg i . Enter the following generate commands:generate wgtsq wgt*wgtgenerate mpgsq mpg 2generate wgtmpg wgt*mpgNote the two equivalent ways of creating the square of a variable. Now estimate by OLS regression equation (4). Enter the following regresscommands:ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 11 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. Abbottregress price wgt mpg wgtsq mpgsq wgtmpgregress price wgt mpg wgtsq mpgsq wgtmpg, level(99)How do the results of these two regress commands differ? Test 3: The first question to ask of Model 2 is whether the additional regressors itintroduces into Model 1 – namely wgt i2 , mpg i2 and wgt i mpg i – are necessary inorder to adequately represent the relationship of pricei to the two continuousexplanatory variables wgti and mpgi. Compare Models 1 and 2.Model 1:price i β 0 β1wgt i β 2 mpg i u i(2)Model 2:price i β 0 β1wgt i β 2 mpg i β3 wgt i2 β 4 mpg i2 β5 wgt i mpg i u i .(4)It is evident from a comparison of Models 1 and 2 that Model 1 imposes on Model2 three coefficient exclusion restrictions, namely the restrictions thatβ3 0, β4 0 and β5 0. These are the three coefficient exclusion restrictions thatwe need to test. The null and alternative hypotheses are:H0: β3 0 and β4 0 and β5 0H1: β3 0 and/or β4 0 and/or β5 0.Note that the null hypothesis H0 implies that Model 1 is empirically adequate,whereas the alternative hypothesis H1 implies rejection of Model 1 in favor ofModel 2. As you will discover from later hypothesis tests in this section, the threecoefficient exclusion restrictions specified by the null hypothesis H0 imply thatboth the marginal effect of wgti on pricei and the marginal effect of mpgi on priceiare constant, meaning they do not depend on wgti or mpgi.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 12 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottThe following test command computes an F-test of H0 against H1. Enter thecommands:test wgtsq mpgsq wgtmpgreturn listInspect the results generated by these commands. State the inference you woulddraw from this test. Based on the results of this test, would you retain or rejectModel 1 against Model 2? Test 4: Test the hypothesis that the marginal effect of wgti on pricei is zero inModel 2 given by regression equation (4). The marginal effect of wgti on pricei is obtained by partially differentiatingregression equation (4) with respect to wgti: pricei β1 2 β3 wgt i β5 mpg i . wgt i Sufficient conditions for price i wgt i 0 for all i are β1 0 and β3 0 and β5 0. We therefore want to test these three coefficient exclusion restrictions. The null and alternative hypotheses are:H0: β1 0 and β3 0 and β5 0H1: β1 0 and/or β3 0 and/or β5 0. The following test command computes an F-test of H0 against H1. Enter thecommands:test wgt wgtsq wgtmpgreturn listInspect the results generated by these commands. State the inference you woulddraw from this test.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 13 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottUse a lincom command to compute the estimated value of the marginal effect ofwgti in equation (4) for a car that weighs 2,500 pounds and gets 25 miles to thegallon. Recall that the expression for price i wgt i in equation (4) is: pricei β1 2 β3 wgt i β5 mpg i . wgt iEvaluated at wgti 2500 and mpgi 25, the estimated marginal effect of wgti onpricei is:estimate of price i ˆ β1 2 βˆ 3 (2500) βˆ 5 (25) . wgt iEnter the commands:lincom wgt 2*wgtsq*2500 wgtmpg*25lincom b[wgt] 2* b[wgtsq]*2500 b[wgtmpg]*25Note that in the first lincom command variable names are used to represent theircorresponding coefficient estimates. Inspect the output generated by these lincomcommands (they are identical). Would you infer that the marginal effect of wgti onpricei is different from zero for a car that weighs 2,500 pounds and has fuelefficiency equal to 25 miles per gallon? Test 5: Test the hypothesis that the marginal effect of mpgi on pricei is zero inModel 2 given by regression equation (4). The marginal effect of mpgi on pricei is obtained by partially differentiatingregression equation (4) with respect to mpgi. pricei β 2 2 β 4 mpg i β5 wgt i . mpg i Sufficient conditions for price i mpg i 0 for all i are β2 0 and β4 0 and β5 0. We therefore want to test these three coefficient restrictions.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 14 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottThe null and alternative hypotheses are:H0: β2 0 and β4 0 and β5 0H1: β2 0 and/or β4 0 and/or β5 0. The following test command computes an F-test of H0 against H1. Enter thecommands:test mpg mpgsq wgtmpgreturn listdisplay Ftail(r(df), r(df r), r(F))Inspect the results generated by these commands. State the inference you woulddraw from this test. Use a lincom command to compute the estimated value of the marginal effect ofmpgi in equation (4) for a car that weighs 2,500 pounds and gets 25 miles to thegallon. Recall that the expression for price i mpg i in equation (4) is: pricei β 2 2 β 4 mpg i β5 wgt i . mpg iEvaluated at wgti 2500 and mpgi 25, the estimated marginal effect of mpgi onpricei is:estimate of price i ˆ β 2 2 βˆ 4 (25) βˆ 5 (2500) . mpg iEnter the commands:lincom mpg 2*mpgsq*25 wgtmpg*2500lincom b[mpg] 2* b[mpgsq]*25 b[wgtmpg]*2500Note again that in the first of the above lincom commands variable names areused to represent their corresponding coefficient estimates. Would you infer thatthe marginal effect of mpgi on pricei is different from zero for a car that weighs2,500 pounds and has fuel efficiency equal to 25 miles per gallon?ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 15 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. Abbott Test 6: Test the hypothesis that the marginal effect of wgti on pricei is constant inModel 2 given by regression equation (4). Recall that the marginal effect of wgti on pricei is obtained by partiallydifferentiating regression equation (4) with respect to wgti: pricei β1 2 β3 wgt i β5 mpg i . wgt i The marginal effect of wgti on pricei is equal to the constant β1 if β3 0 and β5 0. Hence sufficient conditions for price i wgt i β1 a constant for all i are β3 0 and β5 0. So we want to test these two coefficient exclusion restrictions. The null and alternative hypotheses are:H0: β3 0 and β5 0H1: β3 0 and/or β5 0. Since the above null hypothesis specifies two coefficient restrictions on regressionequation (4), we must use an F-test. The following test command computes an Ftest of H0 against H1. Enter the commands:test wgtsq wgtmpgreturn listInspect the results generated by these commands. State the inference you woulddraw from this test. Test 7: Test the hypothesis that the marginal effect of mpgi on pricei is constantin Model 2 given by regression equation (4). Recall that the marginal effect of mpgi on pricei is obtained by partiallydifferentiating regression equation (4) with respect to mpgi: pricei β 2 2 β 4 mpg i β5 wgt i . mpg iECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 16 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. Abbott The marginal effect of mpgi on pricei is equal to the constant β2 if β4 0 and β5 0. Hence sufficient conditions for price i mpg i β 2 a constant for all i are β4 0 and β5 0. We therefore want to test these two coefficient restrictions. The null and alternative hypotheses are:H0: β4 0 and β5 0H1: β4 0 and/or β5 0. Since the above null hypothesis specifies two coefficient restrictions on regressionequation (4), we must use an F-test. The following test command computes an Ftest of H0 against H1. Enter the commands:test mpgsq wgtmpgreturn listInspect the results generated by these commands. State the inference you woulddraw from this test. Test 8: Test the hypothesis that the marginal effect of wgti on pricei is unrelatedto wgti in Model 2 given by regression equation (4). Recall that the marginal effect of wgti on pricei is obtained by partiallydifferentiating regression equation (4) with respect to wgti: pricei β1 2 β3 wgt i β5 mpg i . wgt i A sufficient condition for price i wgt i to be unrelated to wgti for all i is β3 0.We therefore want to test this coefficient exclusion restriction on PRE (4). The null and alternative hypotheses are:H0: β 3 0H1: β3 0.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 17 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottThe following test command computes an F-test of H0 against H1. Enter thecommands:test wgtsqreturn listortest wgtsq 0Inspect the results generated by these commands. State the inference you woulddraw from this F-test. The following lincom command computes a two-tail t-test of H0 against H1. Enterthe commands:lincom b[wgtsq]return listscalar t8 r(estimate)/r(se)scalar list t8display 2*ttail(68, abs(t8))display t8 2display Ftail(1, 68, t8 2)Inspect the results generated by these commands. State the inference you woulddraw from this t-test.Remarks: The above lincom command simply replicates the t-test of this samehypothesis that is reported by the regress command used to estimate regressionequation (4) by OLS. You should be able to explain and verify from the aboveresults why the two-tail t-test of H0: β3 0 versus H1: β3 0 is equivalent to thepreceding F-test of the same hypothesis. Test 9: Consider the following two propositions:1. The marginal effect of wgti on pricei is unrelated to mpgi in Model 2 givenby regression equation (4).2. The marginal effect of mpgi on pricei is unrelated to wgti in Model 2 givenby regression equation (4).ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 18 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. AbbottRecall that the marginal effects on pricei of wgti and mpgi in regression equation(4) are respectively: pricei β1 2 β3 wgt i β5 mpg i marginal effect of wgti wgt i pricei β 2 2 β 4 mpg i β5 wgt i marginal effect of mpgi mpg iHypotheses 1 and 2 imply the same coefficient exclusion restriction on regressionequation (4), namely the restriction β5 0.1. The marginal effect of wgti on pricei is unrelated to mpgi if β5 0 inregression equation (4).2. The marginal effect of mpgi on pricei is unrelated to wgti if β5 0 inregression equation (4). The null and alternative hypotheses for both these propositions are:H0: β 5 0H1: β5 0. The following test command computes an F-test of H0 against H1. Enter thecommands:test wgtmpgreturn listortest wgtmpg 0Inspect the results generated by these commands. State the inference you woulddraw from this F-test. The following lincom command computes a two-tail t-test of H0 against H1.Enter the following commands:lincomreturnscalarscalarb[wgtmpg]listt9 r(estimate)/r(se)list t9ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 19 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. Abbottdisplay 2*ttail(68, abs(t9))display t9 2display Ftail(1, 68, t9 2)Inspect the results generated by these commands. State the inference you woulddraw from this t-test.Remarks: The above lincom command simply replicates the two-tail t-test of thissame hypothesis that is reported by the regress command used to estimateregression equation (4) by OLS. You should be able to explain and verify from theabove results why the two-tail t-test of H0: β5 0 versus H1: β5 0 is equivalentto the F-test of the same hypothesis. Higher Order Polynomial Terms in Continuous Explanatory VariablesBefore concluding that Model 2 given by regression equation (4) provides anadequate representation of the relationships of wgti and mpgi to North American carprices, we should consider whether higher order polynomial terms in the twocontinuous explanatory variables wgti and mpgi are necessary to capture theserelationships. By higher order terms, we mean the third and fourth powers of thecontinuous variables wgti and mpgi.Model 3:price i β 0 β1wgt i β 2 mpg i β3 wgt i2 β 4 mpg i2 β5 wgt i mpg i β 6 wgt 3i β 7 mpg 3i β8 wgt i4 β9 mpg i4 u i(5)wherewgt 3i the cubic (third power) of wgt i for the i-th car;mpg 3i the cubic (third power) of mpg i for the i-th car;wgt i4 the quartic (fourth power) of wgt i for the i-th car;mpg i4 the quartic (fourth power) of mpg i for the i-th car.ECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 20 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. AbbottThe main question we want to address with Model 3 is: Do we need the additionalcubic and quartic terms to adequately represent the relationship of pricei to wgti andmpgi, since these additional regressors considerably complicate the marginal effectsof the two continuous explanatory variables wgti and mpgi?To address this question, we test three sets of exclusion restrictions on the regressioncoefficients of Model 3.The first test (Test 10) addresses the question: Do we need at least one of the fouradditional regressors that Model 3 adds to Model 2, i.e., at least one of the regressorswgt 3i , mpg 3i , wgt i4 and mpg i4 ? This test involves jointly testing on Model 3 the fourcoefficient restrictions β6 0, β7 0, β8 0, and β9 0.The second test (Test 11) addresses the question: Do we need at least one of the tworegressors wgt 3i and wgt i4 to adequately represent the conditional effect of wgti onpricei? This test involves jointly testing on Model 3 the two coefficient restrictions β6 0 and β8 0.The third test (Test 12) addresses the question: Do we need at least one of the tworegressors mpg 3i and mpg i4 to adequately represent the conditional effect of mpgi onpricei? This test involves jointly testing on Model 3 the two coefficient restrictions β7 0 and β9 0. To begin, you must create the new variables wgt 3i , mpg 3i , wgt i4 and mpg i4 . Enterthe following generate commands:generategenerategenerategenerate wgt3rdmpg3rdwgt4thmpg4th wgt 3mpg 3wgt 4mpg 4Now estimate by OLS Model 3 as given by regression equation (5). Enter thefollowing regress command:regress price wgt mpg wgtsq mpgsq wgtmpg wgt3rd mpg3rd wgt4thmpg4thECON 452* -- Fall 2011: Stata 11 Tutorial 3452tutorial03 f2011.docPage 21 of 31 pages

ECONOMICS 452* -- Stata 11 Tutorial 3M.G. Abbott Test 10: Test the hypothesis that all four of the coefficients of the regressorswgt 3i , mpg 3i , wgt i4 and mpg i4 equal zero in Model 3 given by regre

ECONOMICS 452* -- Stata 11 Tutorial 3 M.G. Abbott An alternative way to open (start) a text-format log file is to use the Log button in the button bar near the top of the Stata window. The following steps would replicate what the above log using command does. Click on the Log button in the button bar near the top of the Stata window; this opens the Begin Logging Stata Output dialog box.