0% found this document useful (0 votes)
4 views56 pages

Class 4

The document discusses multivariate regression models (MRM) in the context of identifying and estimating causal effects, particularly focusing on confounders such as CEO tenure, age, and education. It outlines the advantages and disadvantages of MRM, emphasizing its ability to control for confounders and improve prediction, while also noting challenges like the difficulty in measuring some confounders. The document illustrates these concepts through examples comparing salary differences between loyal and non-loyal CEOs, highlighting the impact of age as a confounder.

Uploaded by

benedicttutoring
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views56 pages

Class 4

The document discusses multivariate regression models (MRM) in the context of identifying and estimating causal effects, particularly focusing on confounders such as CEO tenure, age, and education. It outlines the advantages and disadvantages of MRM, emphasizing its ability to control for confounders and improve prediction, while also noting challenges like the difficulty in measuring some confounders. The document illustrates these concepts through examples comparing salary differences between loyal and non-loyal CEOs, highlighting the impact of age as a confounder.

Uploaded by

benedicttutoring
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ECON 644 Class 4

Class 4
Multivariate Regression
Identification & Estimation

Readings:
Wooldridge (2019) Chapter 3
Mitchell (2020) Chapter 3
ECON 644 Class 4

Part I

(1) Confounders

(2) Multivariate Regression Model (MRM)

(3) Advantages and Disadvantages of MRM

(4) Identification

(5) Main Consequence of Mis-Identification: Bias


ECON 644 Class 4

(1) Confounders

Example: Does CEO tenure have a causal effect on CEO salary?

 The simple regression model cannot answer this question


because tenure cannot be randomly assigned.

 Confounders for the tenure-salary link.


age: more loyal CEOs are older & older CEOs can extract
higher salaries.
educ: more loyal CEOs are less educated & less education
hurts someone's salary.
mktval: more loyal CEOs work in larger corporations & the
larger corporations pay more.

 So, if more loyal CEOs are paid differently, is it only because


of their loyalty? Or also because they are older, less educated,
or work in larger corporations?
ECON 644 Class 4

(2) Multivariate Regression Model

Definition: Multivariate Regression Model (MRM)

y  0  1 x1   2 x2  ...   k xk  u
where:
 0 and 1 ,  2 ,...,  k are coefficients (unknown constants).
y and x1 , x2 ,..., xk are variables (observable in the data)
u is an unobservable variable that captures all factors other
than x1 , x2 ,..., xk that affect y .

Note: The key feature is "linear in coefficients" (model doesn’t


need to be “linear in variables.”)
ECON 644 Class 4

Linear in Coefficients vs. Linear in Variables

Question: Which of these two models is linear in coefficients?

salary  0  1ceoten  2 ceoten2  3 age  u

salary  0  1ceoten  12 age  u


ECON 644 Class 4

Linear in Coefficients vs. Linear in Variables

salary  0  1ceoten  2 ceoten2  3 age  u

Linear in the coefficients 1 , 2 , 3 .


Nonlinear (quadratic) in the variable ceoten.

salary  0  1ceoten  12 age  u

Nonlinear (quadratic) in the coefficient 1 .


Linear in the variables ceoten, age.

Conclusion: Only the first model is a (proper) MRM.


ECON 644 Class 4

Language

y dependent variable
x1 , x2 ,..., xk explanatory variables

0 intercept coefficient
1 ,  2 ,...,  k slope coefficients

u error term/unobserved heterogeneity

y  0  1 x1   2 x2  ...   k xk  u
multivariate regression model
(MRM)
ECON 644 Class 4

(3) Advantages and Disadvantages of MRM

ADVANTAGES
1) Better identification. Explicitly controls for confounders
present in observational data.
2) More flexibility. Can model a broader range of nonlinear
relationships between x1 and y than simple regression can.
3) Improves prediction/forecasting. Can account for more of
the variation in y (fits the data better).

DISADVANTAGES
1) Doesn’t tell you what the confounders are.
2) Even if one knew all the confounders, some of them are
hard to observe (measure). Example: CEO age is easy to
measure, but CEO ability not so easy.
3) Can’t control for reverse causation.
ECON 644 Class 4

Flexibility
 Simple Regression Model (always up or always down)

salary  0  1ceoten  u log( salary )  0  1ceoten  u


salary salary

1  0 1  0

ceoten ceoten

 Multivariate Regression Model (sometimes up, sometimes


down)
salary  0  1ceoten  2 ceoten2  v

salary
1  0 2  0

ceoten
ECON 644 Class 4

(4) Identification

Example: Is there a difference in salary between loyal and non-


loyal CEOs?

NON-LOYAL LOYAL
CEOs CEOs

. summarize ceoten
Variable | Obs Mean Std. dev. Min Max
-------------+---------------------------------------------------------
ceoten | 177 7.954802 7.150826 0 37

. display r(mean)
7.9548023

. generate loyal = (ceoten >= r(mean)) // Zero-one variable indicating above-average tenure.

. tabstat salary, statistics(mean) by(loyal) nototal


Summary for variables: salary
Group variable: loyal

loyal | Mean
---------+----------
0 | 766.9806
1 | 1003.5
--------------------

Note: Yes, loyal CEOs make on average $236k more.


ECON 644 Class 4

Salary Comparison

NON-LOYAL LOYAL

(N=103) (N=74)

767k 1,003k

salary Loyal  salary NonLoyal  1003  767  236k


ECON 644 Class 4

Confounder

Question: Can this salary difference by attributed exclusively to


loyalty, or are there other differences between loyal and non-loyal
CEOs that could drive a difference in salaries?

. tabstat age, statistics(mean) by(loyal) nototal

Summary for variables: age


Group variable: loyal

loyal | Mean
---------+----------
0 | 54.58252
1 | 59
--------------------

Note: Loyal CEOs are also about 4.5 years older on average. So
if age correlates with higher salary, then loyalty may not be the
only explanation for the salary difference.
ECON 644 Class 4

Confounder

Question: Is there a difference in salary between young and old?

. summarize age
Variable | Obs Mean Std. dev. Min Max
-------------+---------------------------------------------------------
age | 177 56.42938 8.42189 33 86

. display r(mean)
56.429379

. generate old = (age >= r(mean)) // Zero-one variable indicating above-average age.

. tabstat salary, statistics(mean) by(old) nototal


Summary for variables: salary
Group variable: old

old | Mean
---------+----------
0 | 784.4881
1 | 939.3656
--------------------

Note: Yes, old CEOs make on average $155k more. So it seems


like at least some of the $236k salary difference can be explained
by age differences. How to separate the influence of loyalty from
the influence of age?
ECON 644 Class 4

Loyal vs. Non-Loyal within Age Groups

Split each loyalty group into subgroups, by age.

LOYAL
NON-LOYAL young CEOs
young CEOs
LOYAL
NON-LOYAL old CEOs
old CEOs

 Loyal young CEOs (Mark ZUCKERBERG, Facebook) and


non-loyal young CEOs (Marissa MAYER, Google/Yahoo)
should be more comparable.

 Also, loyal old (Bill GATES, Microsoft) and non-loyal old (Meg
WHITMAN, EBay/HP) should be more comparable.
ECON 644 Class 4

Salary Comparisons, by Age

. tabulate old loyal, summarize(salary) nostandard nofreq noobs

Means of salary

| loyal
old | 0 1 | Total
-----------+----------------------+----------
0 | 720.25862 927.76923 | 784.4881
1 | 827.2 1044.5208 | 939.36559
-----------+----------------------+----------
Total | 766.98058 1003.5 | 865.86441

Note: The mean salary for the full sample is $865k.


The mean salary for loyal is 1,003k.
The mean salary for loyal old is $1,044k.
ECON 644 Class 4

Salary Comparisons, by Age

NON-LOYAL LOYAL NON-LOYAL LOYAL


(N=103) (N=74) (N=58) (N=26)
927k
720k
(N=48)
767k 1,003k

(N=45) 1,044k
827k

salary Loyal  salary NonLoyal  1003  767  236k Young: salary Loyal  salary NonLoyal  927  720  207k
Old: salary Loyal  salary NonLoyal  1044  827  217k
Avg: salary Loyal  salary NonLoyal  212k
Conclusion: The salary difference between loyal and non-loyal
drops from 236k to 212k when age is kept constant.
ECON 644 Class 4

”Controlling” for Age

SRM:
salary   0   1ceoten  v

MRM:
salary   0  1ceoten   2 age  u

Question: Which model can help us better measure the causal


effect of tenure on salary, SRM or MRM?
ECON 644 Class 4

”Controlling” for Age

E ( salary | x1 ,..., xk ) SRM dE ( v | ceoten )


causal effect =  1 
 ceoten d ceoten

E ( salary | x1 ,..., xk ) MRM E (u | ceoten, age)


causal effect =  1 
 ceoten  ceoten

dE (v | ceoten)
Question: When is it the case that  0 , that is,
d ceoten
E (v | ceoten) is the same for all values of ceoten?
E (u | ceoten, age)
Question: When is it the case that  0 , that is,
 ceoten
E (u | ceoten, age) is the same for all values of ceoten?
ECON 644 Class 4

”Controlling” for Age

1) Causal effect =  1 when E ( v | non  loyal )  E ( v | loyal )

Loyal and non-loyal CEOs have, on average, the same age,


education, employer, gender, etc. (No confounders whatsoever.)

2) Causal effect = 1 when E (u | non  loyal , age)  E (u | loyal , age)

Loyal and non-loyal CEOs of the same age have, on average, the
same education, employer, gender, etc. (No confounders other
than age.)

Question: Which of the two statements is more plausible?


ECON 644 Class 4

Identified Model

Definition: In the multivariate regression model


y  0  1 x1   2 x2  ...   k xk  u

if Zero Conditional Mean (MLR.4)


E (u | x1 , x2 ,..., xk )  0
holds, we say that the model is identified.

Compare:
 SLR.4 E (u | x1 )  0 No confounders whatsoever

 MLR.4 E (u | x1 , x2 ,..., xk )  0 No other confounders


(apart from x2 ,..., xk )
ECON 644 Class 4

(5) Mis-Identification Leads to Bias

1
causal effect
tenure salary

1 ( ) 2 ()
age

Simple Regression Slope  1  1   21

Note: 1) The simple regression slope  1 “picks up” the positive


tenure-salary correlation created by age.
2) This bias is positive.
ECON 644 Class 4

Mis-Identification Leads to Bias

causal effect
tenure salary

 
educ

Note: 1) The simple regression slope  1 “picks up” the negative


tenure-salary correlation created by education.
2) This bias is negative.
ECON 644 Class 4

MRM vs. SRM

. regress salary ceoten Biased Upward by the Confounder “age”


Source | SS df MS Number of obs = 177
-------------+---------------------------------- F(1, 175) = 3.65
Model | 1241694.06 1 1241694.06 Prob > F = 0.0577
Residual | 59524270.7 175 340138.69 R-squared = 0.0204
-------------+---------------------------------- Adj R-squared = 0.0148
Total | 60765964.7 176 345261.163 Root MSE = 583.21

------------------------------------------------------------------------------
salary | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ceoten | 11.74613 6.14774 1.91 0.058 -.387127 23.87939
_cons | 772.4263 65.67567 11.76 0.000 642.8079 902.0446
------------------------------------------------------------------------------

. regress salary ceoten age

Source | SS df MS Number of obs = 177


-------------+---------------------------------- F(2, 174) = 2.28
Model | 1549476.74 2 774738.369 Prob > F = 0.1057
Residual | 59216488 174 340324.644 R-squared = 0.0255
-------------+---------------------------------- Adj R-squared = 0.0143
Total | 60765964.7 176 345261.163 Root MSE = 583.37

------------------------------------------------------------------------------
salary | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ceoten | 9.640682 6.535822 1.48 0.142 -3.259013 22.54038
age | 5.277427 5.549411 0.95 0.343 -5.675397 16.23025
_cons | 491.3727 302.7515 1.62 0.106 -106.1654 1088.911
------------------------------------------------------------------------------
ECON 644 Class 4

Part II

(1) Estimating the MRM by OLS

(2) “Partialling Out” Confounding Factors

(3) Properties of OLS Estimates

(4) Properties of OLS Estimators


ECON 644 Class 4

(1) Estimation of the MRM

In the MRM

1 ,  2 ,...,  k (population slopes)


0 (population intercept)

are unknown features of the population.

Question: How can we learn about the size of these unknowns?

Answer: We can collect data on the observables y and x1 , x2 ,..., xk


and use it to estimate  0 and 1 ,  2 ,...,  k .
ECON 644 Class 4

Estimation of the MRM

A possible estimation procedure: Ordinary Least Squares (OLS)


ECON 644 Class 4

OLS

Choose ˆ1 , ˆ2 ,..., ˆk (slope estimates) and ̂ 0 (intercept estimate)
that minimize the sum of the squared differences between the
data and the regression "line."
(actually this is a “plane” – if two dimensions x1 , x2
or a “hyperplane” – if three or more dimensions x1 , x2 ,..., xk ).

n
min  ( yi  yˆi )2
i 1

where ŷ are the fitted values

of the actual values y :


ECON 644 Class 4

Estimating the MRM by OLS

Solving this minimization problem using calculus you'll get the


following formula for the first slope estimator:

where r̂1 are the residuals from regressing x1 on x2 ,..., xk :


x1   1   2 x2   3 x3  ...   k xk  r1 .

Note: The other slope estimators ( ˆ2 ,..., ˆk ) have analogous
formulas.
ECON 644 Class 4

(2) "Partialling Out"

Observation: The first OLS slope estimator ̂1 can also be


obtained in two steps, by running two regressions:
1) Regress x1 on x2 ,..., xk and save the residual r̂1 .
2) Regress y on the residual r̂1 .
The coefficient on r̂1 in the second regression is ̂1!

Intuition: The first regression decomposes the variation in x1 into


two parts:
 x̂1 correlated with the confounders x2 ,..., xk
 r̂1 uncorrelated with the confounders x2 ,..., xk

Thus, the slope on r̂1 in the second regression measures the


association between x1 on y , as if keeping constant x2 ,..., xk .
ECON 644 Class 4

Two-Step Estimation of MRM


. regress ceoten age

Source | SS df MS Number of obs = 177


-------------+---------------------------------- F(1, 175) = 22.68
Model | 1032.67199 1 1032.67199 Prob > F = 0.0000
Residual | 7966.96643 175 45.5255224 R-squared = 0.1147
-------------+---------------------------------- Adj R-squared = 0.1097
Total | 8999.63842 176 51.1343092 Root MSE = 6.7473

------------------------------------------------------------------------------
ceoten | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | .2876175 .0603895 4.76 0.000 .168432 .406803
_cons | -8.275275 3.445275 -2.40 0.017 -15.07491 -1.475637
------------------------------------------------------------------------------

. predict r1hat, residuals

. regress salary r1hat Same Coef. as in One-Step MRM Estimation!


Source | SS df MS Number of obs = 177
-------------+---------------------------------- F(1, 175) = 2.16
Model | 740471.817 1 740471.817 Prob > F = 0.1436
Residual | 60025492.9 175 343002.817 R-squared = 0.0122
-------------+---------------------------------- Adj R-squared = 0.0065
Total | 60765964.7 176 345261.163 Root MSE = 585.66

------------------------------------------------------------------------------
salary | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
r1hat | 9.640682 6.561488 1.47 0.144 -3.309152 22.59052
_cons | 865.8644 44.02123 19.67 0.000 778.9836 952.7453
------------------------------------------------------------------------------
ECON 644 Class 4

(3) Properties of OLS Estimates

(1) They are linear (in the y s) i.e. they can be written as:
c1 y1  c2 y2  ...  cn yn
(2) The sample mean of the OLS residuals û is zero. (the positive
ones exactly cancel the negative ones).
(3) The sample covariance between any explanatory variable x
and the residuals û is zero.
The sample covariance between the fitted value ŷ and the
residuals û is zero (if you plot the residuals against x or ŷ , no
pattern: one is positive, the next is negative, etc.)
(4) The sample regression plane always passes through
( x1 , x2 ,..., xk , y ) .
(5) The sample mean of the fitted values ŷ is equal to the sample
mean of the actual values y .
The sample variance/variation of the fitted values ŷ is smaller
than the sample variance/variation of the actual values y .
ECON 644 Class 4

R-Squared

Sample variation in y = Sample variation in ŷ + Sample variation in û

Definition: Coefficient of determination R 2 :


Sample variation in ŷ / Sample variation in y
In words: the percentage of fitted variation in actual variation, or
the fraction of the actual variation in y that is explained by the
model. It is a measure of goodness of fit between model and
data.

Remarks: 1) R 2   SmplCorr( y, yˆ )
2

2) R 2 cannot go down by adding explanatory variables.


However, we'll see later that we lose estimation precision by
adding explanatory variables without good reason.
3) "It is important not to put too much weight on the
value of R 2 when evaluating econometric models."
(Wooldridge page 103).
ECON 644 Class 4

(4) Properties of OLS Estimators


Question: What properties must the data have in order for the
OLS estimators to be:
unbiased
efficient ?

MLR.1 (population) Data Follows Linear-in-Coeff Model

MLR.2 (sample) Random Sampling

MLR.3 (sample) No Perfect Collinearity


In the sample none of the explanatory variables x1 , x2 ,..., xk is
constant, and there are no exact linear relationships among the
explanatory variables.

MLR.4 (population) Zero Conditional Mean


E (u | x 1, x 2,..., x k )  0

MLR.5 (population) Homoskedasticity, or Constant [Link].


Var (u | x 1, x 2,..., x k )   2
ECON 644 Class 4

OLS Unbiasedness and Efficiency

Theorem 3.1 Under conditions MLR.1 - MLR.4, the OLS


estimators of the  s are unbiased:

Theorem 3.4 (GAUSS-MARKOV) Under conditions MLR.1-


MLR.5 the OLS estimators ˆ0, ˆ1, ˆ2,..., ˆk of the population
coefficients 0, 1, 2,..., k are efficient (have smallest
variance/stddev) relative to all linear and unbiased estimators.
ECON 644 Class 4

MLR.3 No Perfect Collinearity

Example of Perfect Collinearity: All loyal CEOs are old, all non-
loyal CEOs are young (tenure and age are perfectly collinear).

Consequence: Can’t disentangle the effect of loyalty from the


effect of age b/c:
Can’t compare loyal young to non-loyal young.
Can’t compare loyal old to non-loyal old.
(No Mark Zuckerbergs to compare with Marissa Meyers and no
Meg Whitmans to compare to Bill Gates.)
ECON 644 Class 4

High Collinearity

Language: A situation in which there is high correlation among


some explanatory variables is called high collinearity.

Some bad news: One of the key reasons we do multivariate


regression is to control for joint correlates of x and y
(confounders). However, if a confounder is too strong a correlate
of x , putting it explicitly in a MRM will make the slope estimator for
x imprecise. There’s not much we can do about this situation. This
is just a limitation of analyzing observational data.

Some good news: Collinearity only affects the precision of slopes


on the variables that are highly collinear, but doesn’t affect the
precision of the other slopes.
ECON 644 Class 4

High Collinearity

Example: The effect of tenure on CEO compensation.

salary  0  1ceoten  2age  3educ  4mktval  u

Here age is highly collinear with ceoten (sample correlation is


0.3387) so ˆ1, ˆ2 will be imprecise (large standard errors).

On the other hand, mktval is less correlated with ceoten (sample


correlation is 0.0066), so ̂4 should be reasonably precise.
ECON 644 Class 4

MLR.5 Homoskedasticity

Note: Since the model is linear in parameters (MLR.1):


Var (u | x 1, x 2 ,..., x k )  Var (y | x 1, x 2 ,..., xk )
Cond. variance of error = Cond. variance of dependent variable.

Example (Homoskedasticity)
The variance in the GPA of high school students is probably the
same as that in the GPA of college students (grading “on the
curve.”)
Var (GPA | high school )  Var (GPA | college )
Examples (Heteroskedasticity)
(a) The variance in the savings of high-income individuals is
probably larger than the variance in the savings of low-income
individuals.
Var (savings | rich )  Var (savings | poor )
Warren BUFFET/Charlie SHEEN vs. Joe SMITH/Single Mom.
(b) The variance in salaries of old CEOs is larger than for young.
Var (salary | old )  Var (salary | young )
ECON 644 Class 4

Heteroskedasticity

Compare salary variance for young and old CEOs.

. tabstat salary, statistics(variance) by(old) nototal

Summary for variables: salary


Group variable: old

old | Variance
---------+----------
0 | 232123.5
1 | 439576.5
--------------------

Note: The salary variance of the old is almost twice as large as for
the young.
ECON 644 Class 4

Part III

(1) Non-Stata Datafiles

(2) Converting Stata Datafiles into Non-Stata Datafiles

(3) Path of Working Directory

(4) Merging and Appending Datasets

BONUS:
Sample Midterm Question
ECON 644 Class 4

(1) Non-Stata Datafiles

 Excel Data (.xlsx)

 Comma-Separated Values (.csv)

 Space- or Tab- Delimited Data (.txt)

 SPSS Data (.sav)

 SAS XPORT Data (.xpt)

 Fixed-Format Data (.raw)


ECON 644 Class 4

Census Data

Note: Census Bureau makes data available in multiple formats


(ASCII, SAS, CSV).
ECON 644 Class 4

Latinobarometro Data

Note: Latinobarometro makes data available in multiple formats


(SPSS, Stata, SAS, R).
ECON 644 Class 4

Stata Datafiles → Non-Stata Datafiles

Main reasons to convert from Stata to other formats:

 Make your data more widely accessible (to non-Stata users)


 Conserve storage space

Note: Stata datafiles tend to be larger than text-based datafiles. In


this case, by converting to text you save 39% storage space.
(36 - 22)/36 = 0.39
ECON 644 Class 4

Stata Datafiles → Non-Stata Datafiles

Excel Data
File > Export > Data to Excel spreadsheet (*.xls, *.xlsx) >
Leave empty for all variables > Excel filename > create a path
and file name > check the box ”Save variable names as first
row in Excel file.”
. export excel using "E:\UMD\ECON644\Data\[Link]",
firstrow(variables) replace

Comma-Separated Values
File > Export > Text data (delimited, *.csv, …) > Leave empty
for all variables > Write to the file > create a path and file name
> Delimiter > check “Comma-separated format.”
. export delimited using "E:\UMD\ECON644\Data\[Link]",
replace
ECON 644 Class 4

Creating Non-Stata Data Files

Space-Delimited Data
File > Export > Text data (delimited, *.csv, …) > Leave empty
for all variables > Write to the file > create a path and file name
> Delimiter > check “User-specified delimiter.” > in the box
simply insert a space by hitting the space key once.
. export delimited using "E:\UMD\ECON644\Data\[Link]",
delimiter(" ") replace

Tab-Delimited Data
File > Export > Text data (delimited, *.csv, …) > Leave empty
for all variables > Write to the file > create a path and file name
> Delimiter > check “Tab-delimited format.”
. export delimited using "E:\UMD\ECON644\Data\[Link]",
delimiter(tab) replace
ECON 644 Class 4

Creating Non-Stata Data Files

SPSS Data
Note: Stata lacks a built-in command for exporting to SPSS.
But a World Bank economist wrote a package that can be
downloaded from the internet’s Statistical Software
Components (SSC) archive like this:
. ssc install savespss, replace

Then, to create the SPSS datafile:


. savespss "E:\UMD\ECON644\Data\[Link]"

If necessary, the package can later be un-installed with:


. ssc uninstall savespss

SAS XPORT Data


File > Export > SAS XPORT > Leave empty for all variables >
Save file as > create a path and file name
. export sasxport5 "E:\UMD\ECON644\Data\[Link]", rename
ECON 644 Class 4

Creating Non-Stata Data Files

Fixed-Format Data (no dictionary)

File > Export > Text data (fixed- or free- format) > Leave empty
for all variables > Write to the file > create a path and file name
> check: no quotes, one line however wide, right-justified
. outfile using "E:\UMD\ECON644\Data\[Link]", noquote
replace wide rjs
ECON 644 Class 4

(3) Path of Working Directory

Stata uses a working directory (folder) as the default location to


store files. To locate this directory, use the command pwd (path of
the working directory).
. pwd

To change the working directory, use the command cd (change


directory), for example:
. cd "E:\UMD\ECON644”

To check that the working directory was changed, use pwd again.
. pwd

Note: Also shown in the bottom left corner of the Stata console.
ECON 644 Class 4

(4) Merging and Appending Datasets

Merging = join two different sets of variables.

Example: Combine together the CEO’s personal characteristics


(age, education) and the CEO’s company’s characteristics (sales,
profits).
ECON 644 Class 4

Merging and Appending

Appending = join two different sets of observations.

Example: Combine together male CEOs and female CEOs.


ECON 644 Class 4

Merging and Appending

Merging Datasets

Two files: [Link] has personal characteristics.


[Link] has company characteristics.

. use "D:\UMD\ECON644\Data\[Link]", clear


. merge 1:1 id using "D:\UMD\ECON644\Data\[Link]"
. drop _merge

Appending Datasets

Two files: [Link] has male CEOs.


[Link] has female CEOs.

. use "D:\UMD\ECON644\Data\[Link]", clear


. append using "D:\UMD\ECON644\Data\[Link]", generate(_append)
. tabulate _append
. drop _append
ECON 644 Class 4

Sample Midterm Question


Question Consider the effect of CEO tenure (expressed in years with the company,
denoted by ceoten) on CEO salaries (expressed in thousands of dollars, denoted salary).
The sample had 177 CEOs.

(i) The following excerpt from Stata presents summary statistics of the variable salary.
. summarize salary, detail

1990 compensation, $1000s


-------------------------------------------------------------
Percentiles Smallest
1% 129 100
5% 270 129
10% 358 174 Obs 177
25% 471 185 Sum of Wgt. 177

50% 707 Mean 865.8644


Largest Std. Dev. 587.5893
75% 1119 2220
90% 1550 2265 Variance 345261.2
95% 1798 2792 Skewness 2.998603
99% 2792 5299 Kurtosis 20.40129

What is the

mean salary _________


median salary _________
standard deviation _________
smallest salary _________
largest salary _________

in this dataset? (Please write the value in the blank space).


ECON 644 Class 4

(ii) The following Stata excerpt displays summary statistics for the subsample of CEOs over
60 years of age.
. summarize salary if age>=60, detail

1990 compensation, $1000s


-------------------------------------------------------------
Percentiles Smallest
1% 100 100
5% 264 129
10% 358 174 Obs 62
25% 474 264 Sum of Wgt. 62

50% 915 Mean 1013.387


Largest Std. Dev. 758.3528
75% 1253 2102
90% 1750 2220 Variance 575098.9
95% 2102 2265 Skewness 3.056328
99% 5299 5299 Kurtosis 17.59207

How many CEOs in the full sample of 177 CEOs are 60 or older?

What percentage of CEOs in the full sample of 177 CEOs are 60 or older?

(iii) Based on (i) and (ii) does CEO salary seem to be (cor)related to CEO age?
ECON 644 Class 4

(iv) Below is the Stata output from regressing salary on age.


. regress salary age

Source | SS df MS Number of obs = 177


-------------+------------------------------ F( 1, 175) = 2.36
Model | 809004.908 1 809004.908 Prob > F = 0.1262
Residual | 59956959.8 175 342611.199 R-squared = 0.0133
-------------+------------------------------ Adj R-squared = 0.0077
Total | 60765964.7 176 345261.163 Root MSE = 585.33

------------------------------------------------------------------------------
salary | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
age | 8.050256 5.238837 1.54 0.126 -2.289178 18.38969
_cons | 411.5934 298.8802 1.38 0.170 -178.2803 1001.467
------------------------------------------------------------------------------

What are the:

slope estimate? intercept estimate?

What is the meaning of 8.050256 ?

Does the intercept of this regression have any meaning? If so, what is it?

(v) What are the:

std. error of the slope estimate? std. error of the intercept estimate?
ECON 644 Class 4

(vi) What is the R 2 of this regression? What does this value say about how well the
regression line fits the data?

(vii) Based on (i) and (ii) would you argue that older CEOs have higher variation in
salaries? Why? If that were the case what property do OLS estimators lack?

You might also like