ECONOMICS 452* -- Stata 11 Tutorial 6. Stata 11 Tutorial 6. TOPIC: Representing Multi-Category Categorical Variables with Dummy Variable Regressors

Similar documents
ECONOMICS 452* -- Stata 12 Tutorial 6. Stata 12 Tutorial 6. TOPIC: Representing Multi-Category Categorical Variables with Dummy Variable Regressors

Stata 12/13 Tutorial 4

Support Vector Machines

X- Chart Using ANOM Approach

TN348: Openlab Module - Colocalization

Synthesizer 1.0. User s Guide. A Varying Coefficient Meta. nalytic Tool. Z. Krizan Employing Microsoft Excel 2007

Life Tables (Times) Summary. Sample StatFolio: lifetable times.sgp

y and the total sum of

UNIT 2 : INEQUALITIES AND CONVEX SETS

The Codesign Challenge

Econometrics 2. Panel Data Methods. Advanced Panel Data Methods I

S1 Note. Basis functions.

NAG Fortran Library Chapter Introduction. G10 Smoothing in Statistics

6.854 Advanced Algorithms Petar Maymounkov Problem Set 11 (November 23, 2005) With: Benjamin Rossman, Oren Weimann, and Pouya Kheradpour

Solutions to Programming Assignment Five Interpolation and Numerical Differentiation

LOOP ANALYSIS. The second systematic technique to determine all currents and voltages in a circuit

Simulation: Solving Dynamic Models ABE 5646 Week 11 Chapter 2, Spring 2010

Complex Numbers. Now we also saw that if a and b were both positive then ab = a b. For a second let s forget that restriction and do the following.

Problem Set 3 Solutions

Optimization Methods: Integer Programming Integer Linear Programming 1. Module 7 Lecture Notes 1. Integer Linear Programming

Brave New World Pseudocode Reference

Parameter estimation for incomplete bivariate longitudinal data in clinical trials

Lecture 5: Multilayer Perceptrons

Mathematics 256 a course in differential equations for engineering students

2x x l. Module 3: Element Properties Lecture 4: Lagrange and Serendipity Elements

Steps for Computing the Dissimilarity, Entropy, Herfindahl-Hirschman and. Accessibility (Gravity with Competition) Indices

For instance, ; the five basic number-sets are increasingly more n A B & B A A = B (1)

Exercises (Part 4) Introduction to R UCLA/CCPR. John Fox, February 2005

Hermite Splines in Lie Groups as Products of Geodesics

Intro. Iterators. 1. Access

Empirical Distributions of Parameter Estimates. in Binary Logistic Regression Using Bootstrap

Compiler Design. Spring Register Allocation. Sample Exercises and Solutions. Prof. Pedro C. Diniz

CMPS 10 Introduction to Computer Science Lecture Notes

Why visualisation? IRDS: Visualization. Univariate data. Visualisations that we won t be interested in. Graphics provide little additional information

USING GRAPHING SKILLS

Notes on Organizing Java Code: Packages, Visibility, and Scope

Feature Reduction and Selection

R s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes

The BGLR (Bayesian Generalized Linear Regression) R- Package. Gustavo de los Campos, Amit Pataki & Paulino Pérez. (August- 2013)

Machine Learning 9. week

An Optimal Algorithm for Prufer Codes *

EXST7034 Regression Techniques Geaghan Logistic regression Diagnostics Page 1

Analysis of Malaysian Wind Direction Data Using ORIANA

User Authentication Based On Behavioral Mouse Dynamics Biometrics

The Grouping Methods and Rank Estimator, Based on Ranked Set sampling, for the linear Error in Variable Models

Air Transport Demand. Ta-Hui Yang Associate Professor Department of Logistics Management National Kaohsiung First Univ. of Sci. & Tech.

Programming in Fortran 90 : 2017/2018

Lecture #15 Lecture Notes

Signature and Lexicon Pruning Techniques

Assignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.

with Optic65 and Optic25 Cameras FOR OUTDOOR TRACKING ONLY unless used in conjunction with the Indoor Tracking Accessory.

A Semi-parametric Regression Model to Estimate Variability of NO 2

APPLICATION OF MULTIVARIATE LOSS FUNCTION FOR ASSESSMENT OF THE QUALITY OF TECHNOLOGICAL PROCESS MANAGEMENT

FEATURE EXTRACTION. Dr. K.Vijayarekha. Associate Dean School of Electrical and Electronics Engineering SASTRA University, Thanjavur

CS 534: Computer Vision Model Fitting

SVM-based Learning for Multiple Model Estimation

This module is part of the. Memobust Handbook. on Methodology of Modern Business Statistics

A CLASS OF TRANSFORMED EFFICIENT RATIO ESTIMATORS OF FINITE POPULATION MEAN. Department of Statistics, Islamia College, Peshawar, Pakistan 2

AVO Modeling of Monochromatic Spherical Waves: Comparison to Band-Limited Waves

Parallelism for Nested Loops with Non-uniform and Flow Dependences

An Image Fusion Approach Based on Segmentation Region

Determining the Optimal Bandwidth Based on Multi-criterion Fusion

mquest Quickstart Version 11.0

A Binarization Algorithm specialized on Document Images and Photos

Term Weighting Classification System Using the Chi-square Statistic for the Classification Subtask at NTCIR-6 Patent Retrieval Task

A DATA ANALYSIS CODE FOR MCNP MESH AND STANDARD TALLIES

C2 Training: June 8 9, Combining effect sizes across studies. Create a set of independent effect sizes. Introduction to meta-analysis

Intra-Parametric Analysis of a Fuzzy MOLP

The Research of Ellipse Parameter Fitting Algorithm of Ultrasonic Imaging Logging in the Casing Hole

Virtual Memory. Background. No. 10. Virtual Memory: concept. Logical Memory Space (review) Demand Paging(1) Virtual Memory

Lecture 5: Probability Distributions. Random Variables

Wishing you all a Total Quality New Year!

Optimal Workload-based Weighted Wavelet Synopses

A MOVING MESH APPROACH FOR SIMULATION BUDGET ALLOCATION ON CONTINUOUS DOMAINS

Six-Band HDTV Camera System for Color Reproduction Based on Spectral Information

A Post Randomization Framework for Privacy-Preserving Bayesian. Network Parameter Learning

A Simple and Efficient Goal Programming Model for Computing of Fuzzy Linear Regression Parameters with Considering Outliers

Measuring Integration in the Network Structure: Some Suggestions on the Connectivity Index

Variance estimation in EU-SILC survey

Reducing Frame Rate for Object Tracking

3D vector computer graphics

Analysis of Continuous Beams in General

Machine Learning: Algorithms and Applications

On Some Entertaining Applications of the Concept of Set in Computer Science Course

Improvement of Spatial Resolution Using BlockMatching Based Motion Estimation and Frame. Integration

DAD: DISTRIBUTIVE ANALYSIS / ANALYSE DISTRIBUTIVE

UNIVERSITY OF CALIFORNIA. Los Angeles. Development of. Statistical Online Computational Resources. and Teaching Tools

Related-Mode Attacks on CTR Encryption Mode

Classifier Selection Based on Data Complexity Measures *

PYTHON IMPLEMENTATION OF VISUAL SECRET SHARING SCHEMES

Lobachevsky State University of Nizhni Novgorod. Polyhedron. Quick Start Guide

Help for Time-Resolved Analysis TRI2 version 2.4 P Barber,

Cluster Analysis of Electrical Behavior

Sum of Linear and Fractional Multiobjective Programming Problem under Fuzzy Rules Constraints

Introduction to Geometrical Optics - a 2D ray tracing Excel model for spherical mirrors - Part 2

Sequential search. Building Java Programs Chapter 13. Sequential search. Sequential search

ON SOME ENTERTAINING APPLICATIONS OF THE CONCEPT OF SET IN COMPUTER SCIENCE COURSE

IP Camera Configuration Software Instruction Manual

Oracle Database: SQL and PL/SQL Fundamentals Certification Course

5.1 The ISR: Overvieui. chapter

Transcription:

ECONOMICS * -- Stata 11 Tutoral Stata 11 Tutoral TOPIC: Representng Mult-Category Categorcal Varables wth Dummy Varable Regressors DATA: wage1_econ.dta (a Stata-format dataset) TASKS: Stata 11 Tutoral deals wth ssues concernng the nterpretaton, testng and graphcal representaton of the condtonal/margnal effects of multcategory categorcal varables and wth dfferences n the condtonal/margnal effects of mult-category categorcal varables between two mutually exclusve populaton subgroups (e.g., males and females). It llustrates these matters n terms of a smple ln-wage regresson model for male and female employees n whch the mult-categorcal varable of nterest s ndustry of employment, as represented by a seven-category lanatory varable. The Stata commands that consttute the prmary subject of ths tutoral are: regress Used to perform OLS estmaton of multple lnear regresson models. lncom Used after estmaton to compute lnear combnatons of coeffcent estmates and assocated test statstcs. test Used to compute Wald F-tests of lnear coeffcent restrctons, wth notest and accumulate optons. return lst Used to dsplay all temporarly saved results from the most recent test or lncom command. graph bar Used to create bar graphs of the condtonal/margnal effects of a mult-category categorcal varable n lnear regresson models. graph ort Exports the graph currently dsplayed n the Graph wndow to a fle n the current Stata workng drectory. No Stata statstcal functons are used n ths tutoral. NOTE: Stata commands are case senstve. All Stata command names must be typed n the Command wndow n lower case letters. ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral Preparng for Your Stata Sesson Before begnnng your Stata sesson, use Wndows Explorer to copy the Stata-format dataset wage1_econ.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 3, the default Stata workng drectory s usually C:\data. On the computers n MC B111, the default Stata workng drectory s usually D:\courses. Start Your Stata Sesson To start your Stata sesson, double-clck on the Stata con on the Wndows desktop or n the Start menu under Programs. After you double-clck the Stata con, you wll see the 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 text-format.log fle named tutoral.log. To open (begn) the log fle tutoral.log, enter n the Command wndow: log usng tutoral.log Ths command opens a plan text-format (ASCII) fle called tutoral.log n the current Stata workng drectory. Note: It s mportant to nclude the.log fle extenson when openng a log fle; f you do not, your log fle wll be n smcl format, a format that only Stata can read. Once you have opened the tutoral.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 tutoral.log fle. ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral Record Only Your Stata Commands -- cmdlog usng To record only the Stata commands you type durng your Stata sesson, you can use the Stata cmdlog usng command. To start (open) the command log fle tutoral.txt, enter n the Command wndow: cmdlog usng tutoral Ths command opens a plan text-format (ASCII) fle called tutoral.txt n the current Stata workng drectory. All commands you enter durng your Stata sesson are recorded n ths fle. Loadng a Stata-Format Dataset nto Stata use Be certan that you have downloaded the Stata-format dataset wage1_econ.dta from the ECON course web ste, and have placed t n the Stata workng drectory. To check that the Stata-format dataset auto1.dta s n the current Stata workng drectory of the computer at whch you are workng, type n the Command wndow: dr wage1_econ.* You should see n the Stata Results wndow the flename wage1_econ.dta. To load, or read, nto memory the Stata-format dataset auto1.dta, type n the Command wndow: use wage1_econ Ths command loads nto memory the Stata-format dataset wage1_econ.dta. To summarze the contents of the current dataset, use the descrbe and summarze commands. Type n the Command wndow the followng commands: descrbe summarze ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 3 of 3 pages

ECONOMICS * -- Stata 11 Tutoral Model 1 Dfferent Intercepts for Male and Female Employees The dataset wage1_econ.dta contans a bnary ndcator (dummy) varable female that dstngushes between female and male workers. The female ndcator, or dummy, varable s defned as follows: female = 1 f the -th worker s female = f the -th worker s male To see for yourself how the dummy varable female s coded, as well as how many workers n the sample are male and how many are female, enter the followng commands: codebook female tab1 female summarze female, detal In ths secton, we estmate by OLS a regresson model for log hourly wages that constrans all the regresson coeffcents to be the same for female and male employees. Wrte the populaton regresson equaton for Model 1 as: ln(wage ) = β ed 1 3 nd nd nd nd nd3 + δ female + u nd (1) Regresson equaton (1) allows only the ntercept coeffcent to dffer between male and female workers; t restrcts all the slope coeffcents β j (j = 1,, ) to be equal or dentcal for male and female employees. The male ntercept coeffcent s β, and the female ntercept coeffcent s β + δ ; the slope coeffcent of the female ndcator varable female s therefore the female-male dfference n ntercept coeffcents, or equvalently the female-male dfference n condtonal mean ln-wages for gven values of years of completed schoolng, potental work erence, and ndustry of employment. Frst, generate the regressand (or dependent varable) ln( wage ) n Model 1. Enter the commands: generate lnwage = ln(wage) summarze wage lnwage ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral Estmate by OLS regresson equaton (1) on the full sample of observatons for both female and male employees. Enter the regress command: regress lnwage ed sq nd nd3 nd nd nd nd female You wll want to refer back to the OLS estmates of Model 1 produced by ths regress command, as Model 1 represents the benchmark for all subsequent models n ths tutoral. Model Dfferent Industry Effects for Male and Female Employees In ths secton, we consder a regresson model that allows not only the ntercept coeffcent, but also the set of sx ndustry slope coeffcents, to dffer between male and female employees. In other words, Model allows for dfferent ndustry effects for male and female workers, but restrcts the margnal effects of the contnuous lanatory varables ed and to be equal for male and female workers. Model adds to the regressors of Model 1 a set of nteractons of the female ndcator female wth each of the sx ncluded ndustry dummy varables; these female-ndustry nteracton varables are defned as follows: f = f = f = f = f = f = nd femalend nd3 femalend3 nd femalend nd femalend nd femalend nd femalend The populaton regresson equaton for Model can be wrtten as: ln(wage ) = β ed 1 + δ f nd nd nd + δ f nd 3 nd + δ + δ f nd nd female nd3 + δ f nd + δ f nd + u nd + δ f nd3 () ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral Before estmatng Model by OLS, you wll need to create the female-ndustry nteracton varables. Enter the followng generate commands: generate fnd = female*nd generate fnd3 = female*nd3 generate fnd = female*nd generate fnd = female*nd generate fnd = female*nd generate fnd = female*nd Interpretaton of Model : Industry base group s ndustry 1 Before proceedng to estmaton of Model, we should make sure that we understand how to nterpret the ndustry coeffcents n Model. The populaton regresson equaton for Model can be wrtten as: ln(wage ) = β ed 1 + δ f nd nd nd + δ f nd 3 nd + δ + δ f nd nd female nd3 + δ f nd + δ f nd + u nd + δ f nd3 () The populaton regresson functon for Model.1 s obtaned by takng the condtonal ectaton of regresson equaton (.1) for any gven values of the three lanatory varables ed,, nd, nd3, nd, nd, nd, nd and female : E(ln(wage ) ed,, nd, = β K ed 1 + δ f nd nd nd 3 + δ f nd,nd, female ) nd nd + δ + δ f nd nd3 female + δ f nd nd + δ f nd + δ f nd3 (*) The male populaton regresson functon mpled by Model s obtaned by settng the female ndcator varable female = n (*): E(ln(wage ) ed,, nd, K,nd, female = ) ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral = β ed 1 nd nd 3 nd nd nd3 nd (m) The male ndustry ntercept coeffcents are: Industry 1 ntercept coeffcent for males = β Industry ntercept coeffcent for males = β Industry 3 ntercept coeffcent for males = β Industry ntercept coeffcent for males = β Industry ntercept coeffcent for males = β Industry ntercept coeffcent for males = β Industry ntercept coeffcent for males = β The set of ndustry effects for male workers n Model.e., the nter-ndustry dfferences n condtonal mean ln-wages for male employees wth gven values of ed and are gven by the male slope coeffcents of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd that are ncluded as regressors n Model. From the ndustry ntercept coeffcents for males gven above, t follows that these male ndustry effects are: β = the ndustry ndustry 1 dfference n mean ln-wages for males; β = the ndustry 3 ndustry 1 dfference n mean ln-wages for males; β = the ndustry ndustry 1 dfference n mean ln-wages for males; β = the ndustry ndustry 1 dfference n mean ln-wages for males; β = the ndustry ndustry 1 dfference n mean ln-wages for males; β = the ndustry ndustry 1 dfference n mean ln-wages for males. ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral The female populaton regresson functon mpled by Model s obtaned by settng the female ndcator varable female = 1 n (*): E(ln(wage ) ed,, nd, K,nd, female = 1) = β ed 1 + δ nd nd nd 3 nd nd + δ + δ nd + δ nd + δ nd3 + δ nd nd nd + δ nd3 = ( β + ( β + δ ) ed + δ 1 )nd + ( β 3 + ( β + δ )nd + ( β + δ + δ )nd )nd + ( β + ( β + δ + δ )nd3 )nd (f) The female ndustry ntercept coeffcents are: Industry 1 ntercept coeffcent for females = β + δ Industry ntercept coeffcent for females = β + δ + δ Industry 3 ntercept coeffcent for females = β + δ + δ Industry ntercept coeffcent for females = β + δ + δ Industry ntercept coeffcent for females = β + δ + δ Industry ntercept coeffcent for females = β + δ + δ Industry ntercept coeffcent for females = β + δ + δ The set of ndustry effects for female workers n Model.e., the nterndustry dfferences n condtonal mean ln-wages for female employees wth gven values of ed and are gven by the female slope coeffcents of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd that are ncluded as regressors n Model. From the ndustry ntercept coeffcents for females gven above, t follows that these female ndustry effects are: β + δ = the ndustry ndustry 1 dfference n mean ln-wages for females; β + δ = the ndustry 3 ndustry 1 dfference n mean ln-wages for females; β + δ = the ndustry ndustry 1 dfference n mean ln-wages for females; β + δ = the ndustry ndustry 1 dfference n mean ln-wages for females; β + δ = the ndustry ndustry 1 dfference n mean ln-wages for females; β + δ = the ndustry ndustry 1 dfference n mean ln-wages for females. ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral The female-male dfferences n ndustry effects mpled by Model are obtaned by subtractng the male ndustry coeffcents (β, β, β, β, β and β ) from the correspondng female ndustry coeffcents (β + δ, β + δ, β + δ, β + δ, β + δ and β + δ ).e., by the slope coeffcents δ, δ, δ, δ, δ, and δ of the female-ndustry nteracton terms f nd, f nd3, f nd, f nd, f nd, and f nd n Model. For ndustry : β + δ = the ndustry ndustry 1 dfference n mean ln-wages for females β = the ndustry ndustry 1 dfference n mean ln-wages for males Therefore δ = the ndustry ndustry 1 dfference n mean ln-wages for females mnus the ndustry ndustry 1 dfference n mean ln-wages for males Smlarly, for ndustres 3,,, and : δ = the ndustry 3 ndustry 1 dfference n mean ln-wages for females mnus the ndustry 3 ndustry 1 dfference n mean ln-wages for males δ = the ndustry ndustry 1 dfference n mean ln-wages for females mnus the ndustry ndustry 1 dfference n mean ln-wages for males δ = the ndustry ndustry 1 dfference n mean ln-wages for females mnus the ndustry ndustry 1 dfference n mean ln-wages for males δ = the ndustry ndustry 1 dfference n mean ln-wages for females mnus the ndustry ndustry 1 dfference n mean ln-wages for males ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral δ = the ndustry ndustry 1 dfference n mean ln-wages for females mnus the ndustry ndustry 1 dfference n mean ln-wages for males Note that the condtonal effects of ndustry on mean ln-wages are dentcal or equal for male and female workers f the regresson coeffcents δ, δ, δ, δ, δ and δ are jontly equal to zero:.e., f δ = δ = δ = δ = δ = δ =, or f δ j = for all j =,,,. OLS Estmaton of Model Estmate Model by OLS on the full sample of female and male employees. Enter the regress command: regress lnwage ed sq nd nd3 nd nd nd nd female fnd fnd3 fnd fnd fnd fnd Use lncom commands to compute and test the female ntercept coeffcent estmate and the female coeffcent estmates for the ndustry dummy varables nd, nd3, nd, nd, nd, and nd n Model. Enter the followng seres of lncom commands: + δˆ lncom _b[_cons] + _b[female] = lncom _b[nd] + _b[fnd] = βˆ ˆ + δ lncom _b[nd3] + _b[fnd3] = βˆ ˆ + δ lncom _b[nd] + _b[fnd] = βˆ ˆ + δ lncom _b[nd] + _b[fnd] = βˆ ˆ + δ lncom _b[nd] + _b[fnd] = βˆ ˆ + δ lncom _b[nd] + _b[fnd] = βˆ ˆ + δ βˆ ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral Test for Industry Effects n Model We now wsh to test for ndustry effects n Model. There are three such tests that should be performed. Industry Effects Test 1: Test for ndustry effects for male employees Test the null hypothess of no ndustry effects for male employees n Model. Snce ndustry effects for males n Model are represented by the male slope coeffcents β, β, β, β, β and β of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd, the null and alternatve hypotheses are specfed as follows: H : β j = for all j =,,, ; or β = and β = and β = and β = and β = and β = H 1 : β j j =,,, ; or β and/or β and/or β and/or β and/or β and/or β Use the followng test command to compute an F-test of the null hypothess of no ndustry effects for male employees. Enter the commands: test nd nd3 nd nd nd nd return lst Based on the computed outcome of ths test, would you retan or reject the null hypothess of no ndustry effects for male workers? Industry Effects Test : Test for ndustry effects for female employees Test the null hypothess of no ndustry effects for female employees n Model. Snce ndustry effects for females n Model are represented by the female slope coeffcents β + δ, β + δ, β + δ, β + δ, β + δ and β + δ of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd n the female ln-wage regresson functon, the null and alternatve hypotheses are specfed as follows: ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 11 of 3 pages

ECONOMICS * -- Stata 11 Tutoral H : β j + δ j = for all j =,,, ; or β + δ = and β + δ = and β + δ = and β + δ = and β + δ = and β + δ = H 1 : β j + δ j j =,,, ; or β + δ and/or β + δ and/or β + δ and/or β + δ and/or β + δ and/or β + δ Use the followng seres of lnked test commands to compute an F-test of the null hypothess of no ndustry effects for female employees. Enter the commands: test nd + fnd =, notest test nd3 + fnd3 =, notest accumulate test nd + fnd =, notest accumulate test nd + fnd =, notest accumulate test nd + fnd =, notest accumulate test nd + fnd =, accumulate return lst Note that only the results produced by the last of ths sequence of sx test commands correspond to the null hypothess H of no ndustry effects for female workers. That s why the notest opton has been specfed for the frst fve test commands n ths sequence; the notest opton smply suppresses the prntng of the results of the test command to whch t s attached. Based on the computed outcome of ths test, would you retan or reject the null hypothess of no ndustry effects for female workers? Industry Effects Test 3: Test for female-male dfferences n ndustry effects Test the null hypothess of no female-male dfferences n ndustry effects n Model. Snce the female-male dfferences n ndustry effects n Model are represented by the slope coeffcents δ, δ, δ, δ, δ and δ of the female nteractons wth the ndustry dummy varables nd, nd3, nd, nd, nd, and nd n Model, the null and alternatve hypotheses are specfed as follows: ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral H : δ j = for all j =,,, ; or δ = and δ = and δ = and δ = and δ = and δ = H 1 : δ j j =,,, ; or δ and/or δ and/or δ and/or δ and/or δ and/or δ Use the followng test command to compute an F-test of the null hypothess of no female-male dfferences n ndustry effects n Model,.e., that ndustry effects are equal, or dentcal, for male and female employees. Enter the commands: test fnd fnd3 fnd fnd fnd fnd return lst Based on the computed outcome of ths test, would you retan or reject the null hypothess of no ndustry effects for male workers? Note: If you have correctly computed the foregong test of no female-male dfferences n ndustry effects n Model, you wll have found that the null hypothess H s retaned at all conventonal sgnfcance levels. Despte ths test outcome, we wll, for pedagogcal reasons, proceed wth learnng how Stata graph bar commands can be used to graphcally llustrate the male and female ndustry effects n Model. But bear n mnd that ths test mples that ndustry effects n Model do not dffer sgnfcantly between male and female workers. Model -- Graphng Industry Effects for Male and Female Employees Ths secton demonstrates how to use the Stata graph bar command to graphcally llustrate the male and female ndustry effects we have estmated for Model. Before we can use the graph bar command, we must save the male and female ndustry coeffcent estmates for Model n a form that can be used n the graph bar command. Step 1: Generate a new varable that contans the values of the male ndustry coeffcent estmates for Model ;.e., create a varable that contans the OLS ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 13 of 3 pages

ECONOMICS * -- Stata 11 Tutoral estmates for Model of the male coeffcents for the ndustry dummy varables nd, nd3, nd, nd, nd, and nd n Model. Use the followng seres of generate and replace commands to create a new varable named malndcoefs_model that contans the OLS coeffcent estmates for Model of the male slope coeffcents β, β, β, β, β and β of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd. Enter the followng seres of generate and replace commands: generate malndcoefs_model = _b[nd] f nd == 1 & female == replace malndcoefs_model = _b[nd3] f nd3 == 1 & female == replace malndcoefs_model = _b[nd] f nd == 1 & female == replace malndcoefs_model = _b[nd] f nd == 1 & female == replace malndcoefs_model = _b[nd] f nd == 1 & female == replace malndcoefs_model = _b[nd] f nd == 1 & female == Next, we should verfy that the varable malndcoefs_model we have just created does ndeed contan the OLS coeffcent estmates for Model of the male slope coeffcents β, β, β, β, β and β of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd. Enter the followng seres of summarze commands: summarze malndcoefs_model f nd == 1 & female == summarze malndcoefs_model f nd3 == 1 & female == summarze malndcoefs_model f nd == 1 & female == summarze malndcoefs_model f nd == 1 & female == summarze malndcoefs_model f nd == 1 & female == summarze malndcoefs_model f nd == 1 & female == Fnally, enter the followng tab1 commands: tab1 ndustry malndcoefs_model, mssng tab1 ndustry malndcoefs_model table ndustry, contents(mean malndcoefs_model) ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral Step : Generate a new varable that contans the values of the female ndustry coeffcent estmates for Model ;.e., create a varable that contans the OLS estmates for Model of the female coeffcents for the ndustry dummy varables nd, nd3, nd, nd, nd, and nd n Model. Use the followng seres of generate and replace commands to create a new varable named femndcoefs_model that contans the OLS coeffcent estmates for Model of the female slope coeffcents β + δ, β + δ, β + δ, β + δ, β + δ and β + δ of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd. Enter the followng seres of generate and replace commands: generate femndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 replace femndcoefs_model = _b[nd3] + _b[fnd3] f nd3 == 1 & female == 1 replace femndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 replace femndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 replace femndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 replace femndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 Next, verfy that the varable femndcoefs_model we have just created does ndeed contan the OLS coeffcent estmates for Model of the female slope coeffcents β + δ, β + δ, β + δ, β + δ, β + δ and β + δ of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd. Enter the followng seres of summarze commands: summarze femndcoefs_model f nd == 1 & female == 1 summarze femndcoefs_model f nd3 == 1 & female == 1 summarze femndcoefs_model f nd == 1 & female == 1 summarze femndcoefs_model f nd == 1 & female == 1 summarze femndcoefs_model f nd == 1 & female == 1 summarze femndcoefs_model f nd == 1 & female == 1 Fnally, enter the followng tab1 commands: ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral tab1 ndustry femndcoefs_model, mssng tab1 ndustry femndcoefs_model table ndustry, contents(mean femndcoefs_model) table ndustry, contents(mean malndcoefs_model mean femndcoefs_model) Step 3: We can now use the newly created varables malndcoefs_model and femndcoefs_model to draw a bar graph of the estmated male and female ndustry effects n Model. Use the followng basc graph bar command to create a frst bar graph of the estmated male and female ndustry effects n Model. Enter the graph bar command: graph bar (mean) malndcoefs_model femndcoefs_model f ndustry > 1, over(ndustry) We can produce a more complete and nformatve bar graph by addng to the above graph bar command some addtonal optons that label the bars as Male or Female, that provde a ttle for the vertcal y-axs, and that provde a ttle for the entre graph. Enter the followng anded graph bar command: graph bar (mean) malndcoefs_model femndcoefs_model f ndustry > 1, over(ndustry) legend ( label(1 "Male") label( "Female") ) yttle("mean ndustry ln-wage dfference" "relatve to ndustry 1 (log ponts)") ttle("mean Ln-Wage Dfferences Relatve to Industry 1," "Industres to by Gender -- Model ") Carefully observe how the graph bar optons legend, yttle and ttle have been used to provde a more fnshed and complete bar graph. To ort and save ths bar graph n Wndows Enhanced Metafle format to a fle named bargraph1_tutoral.emf n the current Stata workng drectory, enter the graph ort command: graph ort bargraph1_tutoral.emf ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral Here s what the bar graph you just orted n Wndows Enhanced Metafle format to the fle bargraph1_tutoral.emf looks lke when t s nserted nto ths MS Word document: Mean Ln-Wage Dfferences Relatve to Industry 1, Industres to by Gender, Model mean ndustry ln-wage dfference relatve to ndustry 1 (log ponts) -. -.3 -. -.1 Industry Industry 3 Industry Industry Industry Industry Male Female You can produce a horzontal verson of the bar graph you have just created by usng the graph hbar command rather than the graph bar command. Enter the followng anded graph hbar command: graph hbar (mean) malndcoefs_model femndcoefs_model f ndustry > 1, over(ndustry) legend ( label(1 "Male") label( "Female") ) yttle("mean ndustry ln-wage dfference" "relatve to ndustry 1 (log ponts)") ttle("mean Ln-Wage Dfferences Relatve to Industry 1," "Industres to by Gender -- Model ") Note that the above command s dentcal to the graph bar command on the prevous page except for the use of the graph hbar command. Agan observe how the graph hbar optons legend, yttle and ttle have been used to provde a more fnshed and complete bar graph. ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral To ort and save ths bar graph n Wndows Enhanced Metafle format to a fle named bargraph_tutoral.emf n the current Stata workng drectory, enter the graph ort command: graph ort bargraph_tutoral.emf Here s what the horzontal bar graph you just orted n Wndows Enhanced Metafle format to the fle bargraph_tutoral.emf looks lke when t s nserted nto ths MS Word document: Mean Ln-Wage Dfferences Relatve to Industry 1, Industres to by Gender, Model Industry Industry 3 Industry Industry Industry Industry -. -.3 -. -.1 mean ndustry ln-wage dfference relatve to ndustry 1 (log ponts) Male Female ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral A Thrd Bar Graph Depctng the Industry Effects for Males and Females Fnally, we can use an alternatve graph hbar command to create a second horzontal bar graph that depcts the ndustry effects for male and female workers estmated n Model. But frst we must save the male and female ndustry coeffcent estmates for Model n a form that can be used n the graph hbar command. Step 1: Generate a new varable that contans the values of the male ndustry coeffcent estmates for Model ;.e., create a varable that contans the OLS estmates for Model of the male coeffcents for the ndustry dummy varables nd, nd3, nd, nd, nd, and nd n Model. Use the followng seres of generate and replace commands to create a new varable named allndcoefs_model that contans the OLS coeffcent estmates for Model of both the male slope coeffcents β, β, β, β, β and β of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd and the female slope coeffcents β + δ, β + δ, β + δ, β + δ, β + δ and β + δ of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd. Enter the followng seres of generate and replace commands: generate allndcoefs_model = _b[nd] f nd == 1 & female == replace allndcoefs_model = _b[nd3] f nd3 == 1 & female == replace allndcoefs_model = _b[nd] f nd == 1 & female == replace allndcoefs_model = _b[nd] f nd == 1 & female == replace allndcoefs_model = _b[nd] f nd == 1 & female == replace allndcoefs_model = _b[nd] f nd == 1 & female == replace allndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 replace allndcoefs_model = _b[nd3] + _b[fnd3] f nd3 == 1 & female == 1 replace allndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 replace allndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral replace allndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 replace allndcoefs_model = _b[nd] + _b[fnd] f nd == 1 & female == 1 Next, verfy that the varable allndcoefs_model we have just created does ndeed contan the OLS coeffcent estmates for Model of both the male slope coeffcents β, β, β, β, β and β and the female slope coeffcents β + δ, β + δ, β + δ, β + δ, β + δ and β + δ of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd. Enter the followng seres of summarze commands: summarze allndcoefs_model f nd == 1 & female == summarze allndcoefs_model f nd3 == 1 & female == summarze allndcoefs_model f nd == 1 & female == summarze allndcoefs_model f nd == 1 & female == summarze allndcoefs_model f nd == 1 & female == summarze allndcoefs_model f nd == 1 & female == summarze allndcoefs_model f nd == 1 & female == 1 summarze allndcoefs_model f nd3 == 1 & female == 1 summarze allndcoefs_model f nd == 1 & female == 1 summarze allndcoefs_model f nd == 1 & female == 1 summarze allndcoefs_model f nd == 1 & female == 1 summarze allndcoefs_model f nd == 1 & female == 1 Fnally, enter the followng tab1 and tab commands: tab1 ndustry allndcoefs_model f female ==, mssng tab1 ndustry allndcoefs_model f female == 1, mssng tab allndcoefs_model female, mssng tab ndustry female, mssng Careful nspecton of the results of these tab1 and tab commands wll enable you to verfy that the newly created varable allndcoefs_model does ndeed contan the OLS coeffcent estmates for Model of both the male slope coeffcents β, β, β, β, β and β and the female slope coeffcents β + δ, β + δ, β + δ, β + δ, β + δ and β + δ of the ndustry dummy varables nd, nd3, nd, nd, nd, and nd. ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral Step : We can now use the newly created varable allndcoefs_model to draw a horzontal bar graph of the estmated male and female ndustry effects n Model. Use the followng basc graph hbar command to create a frst horzontal bar graph of the estmated male and female ndustry effects n Model. Enter the graph bar command: graph hbar (mean) allndcoefs_model f ndustry > 1, over(female) over(ndustry) Note that the above graph hbar command ncludes both the over(female) and the over(ndustry) optons. We can produce a more complete and nformatve bar graph by addng to the above graph hbar command some addtonal optons that provde a ttle for the vertcal y-axs, and that provde a ttle for the entre graph. Enter the followng anded graph hbar command: graph hbar (mean) allndcoefs_model f ndustry > 1, over(female) over(ndustry) yttle("mean ndustry ln-wage dfference" "relatve to ndustry 1 (log ponts)") ttle("mean Ln-Wage Dfferences Relatve to Industry 1," "Industres to by Gender, Model ", span) Note that the opton span s specfed n the ttle( ) porton of the above graph hbar command; t centers the ttle over the entre graph rather than over the plot regon. To ort and save ths bar graph n Wndows Enhanced Metafle format to a fle named bargraph3_tutoral.emf n the current Stata workng drectory, enter the graph ort command: graph ort bargraph3_tutoral.emf ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 1 of 3 pages

ECONOMICS * -- Stata 11 Tutoral Here s what the horzontal bar graph you just orted n Wndows Enhanced Metafle format to the fle bargraph3_tutoral.emf looks lke when t s nserted nto ths MS Word document: Mean Ln-Wage Dfferences Relatve to Industry 1, Industres to by Gender, Model Industry Industry 3 Industry Industry Industry Industry Male Female Male Female Male Female Male Female Male Female Male Female -. -.3 -. -.1 mean ndustry ln-wage dfference relatve to ndustry 1 (log ponts) ECON * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page of 3 pages

ECONOMICS * -- Stata 11 Tutoral Preparng to End Your Stata Sesson Before you end your Stata sesson, you should do two thngs. Frst, you wll probably want to save the current dataset. Enter the followng save command wth the replace opton to save the current dataset as Stata-format dataset wage1_econ.dta: save wage1_econ, replace Second, close the log fle you have been recordng. Enter the command: log close Fnally, close the command log fle you have been recordng. Enter the command: cmdlog 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 portable electronc storage devce such as a flash memory stck. These fles wll be found n the Stata workng drectory, whch s usually C:\data on the computers n Dunnng 3. There are three fles you wll want to be sure you have: the complete Stata log fle tutoral.log; the Stata command log fle tutoral.txt; and the changed Stata-format dataset wage1_econ.dta. Use the Wndows copy command to copy any fles you want to keep to your own portable electronc storage devce (e.g., a flash memory stck). 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 * -- Fall 11: Stata 11 Tutoral tutoral_f11.doc Page 3 of 3 pages