0% found this document useful (0 votes)
2 views61 pages

Class 5

The document outlines the concepts of multiple regression analysis, focusing on estimation, standard errors, and confidence intervals for causal effects. It discusses the importance of identifying the causal effect of variables, the role of standard errors in linking sample estimates to population parameters, and the distinction between being 'different from' and 'statistically different from' zero. Additionally, it covers hypothesis testing methods and provides examples related to CEO tenure and salary.

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)
2 views61 pages

Class 5

The document outlines the concepts of multiple regression analysis, focusing on estimation, standard errors, and confidence intervals for causal effects. It discusses the importance of identifying the causal effect of variables, the role of standard errors in linking sample estimates to population parameters, and the distinction between being 'different from' and 'statistically different from' zero. Additionally, it covers hypothesis testing methods and provides examples related to CEO tenure and salary.

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 5

Class 5
Multiple Regression
Inference I

Readings:
Wooldridge (2025) Chapter 4
ECON 644 Class 5

Part I

(1) Estimate

(2) Standard Error

(3) “Different From” vs. "Statistically Different From"

(4) Confidence Interval for Causal Effect


ECON 644 Class 5

Regression Analysis: Three Stages

(1) Identification. If the error term u of the model:


y  0  1 x1   2 x2  ...   k xk  u
has zero conditional mean, then the population slope 1
measures the causal effect of x1 on y .

(2) Estimation. Under certain conditions (MLR.1-MLR.5) the


OLS slope estimator ̂1 is a good (i.e., unbiased and
efficient) estimator of 1.

(3) Inference. Use the estimate ̂1 (a sample feature) to make


claims about the slope coefficient 1 (a population feature).
For this we need se( ̂1).
ECON 644 Class 5

(1) Estimate ̂1

OLS Estimation produces:


 coefficient estimates ˆ0 , ˆ1 , ˆ2 ,...
 standard errors se( ˆ0 ), se( ˆ1 ), se( ˆ2 ),...

Question: What does ̂1 have to do with 1?


Answer: The slope estimate ̂1 is the causal effect “in the
sample,” the slope 1 is the causal effect in the population.

Question: How close is ̂1 to 1?


Answer: That's what se( ̂1) is going to tell us.
ECON 644 Class 5

(2) Standard Error se( ̂1 )

 se( ̂1) is as important as the estimate ̂1.

 Why? Because it makes the link between the sample slope ̂1
and the population slope 1.

 Claim: The population slope 1 is inside the interval:


 ˆ1  t  se( ˆ1 ), ˆ1  t  se( ˆ1 ) 
with some confidence that depends on t .

 Note: A smaller standard error means a narrower confidence


interval. A narrower CI means we know more about the
population slope 1.
ECON 644 Class 5

Sampling Error

 But why can’t the population slope 1 be pinpointed exactly?

 It could, but only with data for the entire population (census).
Otherwise you need to allow for sampling error: the sample,
though random, may not be perfectly representative of the
population.

 The standard error is a measure of sampling error.

 Remember fine print in opinion polls: “The margin of statistical


error is 3% .”
ECON 644 Class 5

(3) "Different From” vs. "Statistically Different From"

IF

0 [------- ̂1-------]

THEN

 the estimate ̂1


is different from 0.
is statistically different from zero (or, “statistically
significant”).
 the population causal effect 1
is positive (with 95% confidence).
ECON 644 Class 5

"Different From” vs. "Statistically Different From"

IF

[--0--- ̂1--------]

THEN

 the estimate ̂1


is different from 0.
is not statistically different from zero (or, “statistically
insignificant”).
 The population causal effect 1
could be negative, zero, or positive.
ECON 644 Class 5

(4) How to Compute a CI?

To build the CI ˆ1  t  se( ˆ1 ) for the causal effect 1 we need:

1) A sample from the population (make it random, so the


OLS estimator ̂1 is unbiased).

2) A good estimator of 1 (call it ̂1 ).


This will be our “best guess” for 1.

3) The probability distribution of ̂1 .


This will help us compute
(i) the standard error se( ̂1 ).
(ii) the critical number t .
ECON 644 Class 5

CI for Causal Effect

1) We can always get a random sample for cross-sectional data


(with enough planning and research money).

2) We found pretty good estimators of the  s (namely the OLS


estimators).

however:

3) We don't really know much about the probability distribution of


the OLS estimators except for their mean and their variance:
E (ˆj )  j
 2
Var (ˆj ) 
SSTj 1  Rj 2 

Question: Why were the mean and variance of the estimator


useful to know?
ECON 644 Class 5

CI for Causal Effect

Question: How can we know the distribution of the OLS


estimators?

The bad news:


With small samples, it's impossible to know the exact
distribution of the OLS estimators, b/c it depends on the
distribution of the error term u , which by definition is
unobservable.

The good news:


With large samples, the distribution of the OLS estimators can
be shown to be approximately normal regardless of the
distribution of the error term.
This is an application of the CLT (see Chapter 5 in
Wooldridge).
ECON 644 Class 5

CI for Causal Effect

For small samples, one way out:

Assume (read "hope") that the distribution of the error term is


normal.

MLR.6 The population error u is independent of the


explanatory variables x1 , x2 ,..., xk and is normally distributed
with zero mean and constant variance:
u ~ N (0, 2 ) .

Language: A regression model that satisfies conditions MLR.1-


MLR.6 is also called the classical regression model.
ECON 644 Class 5

Distribution of OLS Estimators w/ Normal Error Term

Theorem 4.1 Under assumptions MLR.1-MLR.6, conditional on


the independent variables, the OLS estimators have a normal
distribution:

Note: However, we may not know Var (ˆj ) . Then, we would need
to estimate it.
ECON 644 Class 5

Distribution of OLS Estimators w/ Normal Error Term

Theorem 4.2 Under assumptions MLR.1-MLR.6, conditional on


the independent variables, the standardized OLS estimators
(using the estimated standard deviation, i.e., the standard error)
have a t distribution:

Note: If the error term has constant conditional variance, then:


MLR.5
ˆ2
se(ˆ1 ) 
SST1 1  R12 
SSR
where ˆ 
2
.
n k 1
ECON 644 Class 5

Regression with Normal Error Term


ECON 644 Class 5

CI for Causal Effect

Claim: Under MLR.1-MLR.6 the population slope 1 is inside


 ˆ1  t  se( ˆ1 ), ˆ1  t  se( ˆ1 ) 
with some confidence.

For any sample size For large samples


(use exact t distribution): (use std. normal approximation):
t  tnk 1 (0.10) for 90% confid for 90% confid
t  tnk 1 (0.05) for 95% confid for 95% confid
t  tnk 1 (0.01) for 99% confid for 99% confid

Note: More confidence, wider interval.


ECON 644 Class 5

What is a “Large Sample”?

 If variance known:

Normality under CLT kicks in around n  30 .

 If variance unknown:

Need to estimate sd() with the se().


Then tn  N (0,1) when n  120 .
ECON 644 Class 5

Stata: CI for Coef Estimates


. regress salary ceoten, nopvalues

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. [95% Conf. Interval]
-------------+------------------------------------------------
ceoten | 11.74613 6.14774 -.387127 23.87939
_cons | 772.4263 65.67567 642.8079 902.0446
--------------------------------------------------------------

Unpacking the CI calculation:


. display _b[ceoten]
11.746129

. display _se[ceoten]
6.1477399

. display invt(175,.975)
1.9736125 Note: t-value pretty close to 1.96.

. display _b[ceoten]-invt(175,.975)*_se[ceoten]
-.38712697

. display _b[ceoten]+invt(175,.975)*_se[ceoten]
23.879385
ECON 644 Class 5

Stata: A 99% CI

. regress salary ceoten, level(99) nopvalues

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. [99% Conf. Interval]
-------------+------------------------------------------------
ceoten | 11.74613 6.14774 -4.263905 27.75616
_cons | 772.4263 65.67567 601.3927 943.4598
--------------------------------------------------------------

Note: More confidence, wider interval.


ECON 644 Class 5

Part II

(1) Types of Testable Hypotheses

(2) Hypothesis Type 1


Significance Test vs. Magnitude Test
Three Testing Methods

(3) Sign, Size, Significance


ECON 644 Class 5

(1) Types of Hypotheses

Type 1 One Coefficient: 1 .

Type 2 One Linear Combination of Coefficients: 1  2 .

Type 3 Multiple Linear Combinations of Coefficients: 1  2 ,


31  22 , etc.
ECON 644 Class 5

(i) Single Coefficient

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

Example 1: Hypotheses about the return to CEO tenure ( 1 ).

 Is there a causal effect of tenure on salary?

H 0 : 1  0
H1 : 1  0

 Is the return to one more year of tenure at least $20,000?

H 0 : 1  20
H1 : 1  20
ECON 644 Class 5

(ii) Single Linear Combination

Example 2: The return to CEO tenure vs. the return to age.

 Is the return to CEO tenure at least two times greater than the
return to age?
H 0 : 1  22
H1 : 1  22

 Is the combined effect of tenure and age at least $50,000?

H 0 : 1  2  50
H1 : 1  2  50
ECON 644 Class 5

(iii) Multiple Linear Combinations

Example 3: The significance of age and grad school.

 Are age and grad school "jointly significant" in affecting


salary? (i.e., does at least one of them affect salary?):

H 0 : 2  0 and 3  0
H1 : 2  0 or 3  0
ECON 644 Class 5

(2) Hypotheses Type 1

(1) Significance Test: H1 :   0


(Translation: There is a causal effect!)

(2) Magnitude Test: H1 :   20


(Translation: The causal effect is greater than 20.)
ECON 644 Class 5

Three Testing Methods

ˆ j
(i) t-stat t -stat 
se( ˆ j )

(ii) p-value p-value  P  tnk 1  t -stat 

(iii) confidence interval CI  ˆ j  tnk 1se( ˆ j )


ECON 644 Class 5

Stata® Significance Tests

Note: Significance tests come standard in Stata’s regression


output.

. regress salary ceoten age grad mktval

Source | SS df MS Number of obs = 177


-------------+------------------------------ F( 4, 172) = 9.87
Model | 11348587.4 4 2837146.84 Prob > F = 0.0000
Residual | 49417377.4 172 287310.334 R-squared = 0.1868
-------------+------------------------------ Adj R-squared = 0.1678
Total | 60765964.7 176 345261.163 Root MSE = 536.01

------------------------------------------------------------------------------
salary | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ceoten | 10.55413 6.019706 1.75 0.081 -1.327879 22.43614
age | 1.649817 5.162111 0.32 0.750 -8.539427 11.83906
grad | -43.43346 82.2966 -0.53 0.598 -205.8748 119.0079
mktval | .0371649 .0063706 5.83 0.000 .0245903 .0497395
_cons | 578.0711 288.3528 2.00 0.047 8.905383 1147.237
------------------------------------------------------------------------------

t -stat p -value for 95% CI for 1


H 0 : 1  0
ECON 644 Class 5

How to Read the Numbers

(i) t-statistic

̂ statistically different from zero


large sample

 t  1.96

(ii) p-value

̂ statistically different from zero  p  0.05

(iii) confidence interval

̂ statistically different from zero  CI doesn’t contain zero.


ECON 644 Class 5

Is ˆ1  10.55 “Significant”?

(i) Look at the t-statistic


t  1.75 ( 1.96) ̂1 not significant.

(ii) Look at the p-value


p  0.081 ( 0.05) ̂1 not significant.

(iii) Look at the confidence interval


[ 1.32,22.43] (contains 0) ̂1 not significant.
ECON 644 Class 5
Plotting Regression Coefficients

Install coefplot command in Stata:


. ssc install coefplot, replace

. quietly regress salary ceoten age grad mktval


. coefplot, drop(_cons) xline(0) xtitle(Regular Coefficients)
ECON 644 Class 5

The Testing Procedure

1) Null and Alternative Hypotheses

2) Test Statistic

3) Critical Threshold

4) Decision: Reject/Do Not Reject the Null


ECON 644 Class 5

Testing H 0 :  j  0 against H1 :  j  0
1) Set up the null and alternative hypotheses
ˆ j
2) An appropriate test statistic is which under the closest
ˆ
se(  j )
null hypothesis (  j  0 ) has a tnk 1 distribution (by Theorem 4.2).
3) a) Adopt a reasonable confidence level (say, 95%) and find the
2 tails
threshold tn k 1 (0.05) in the tnk 1 distribution beyond which the
probability of getting a tnk 1 value in either tail is 5% . The
rejection region is tnk 1  tn2tails
k 1 (0.05) .

ˆ j
4) a) Reject H 0 if the test statistic is in the rejection
se( ˆ j )
region. Otherwise, don't reject H 0 .
 ˆ j 
3) b) Compute the p  value of the test: P  tnk 1  
ˆ
se(  j ) 

4) b) Reject H 0 if the p  value is low enough.
ECON 644 Class 5

. display invt(25,.025)
-2.0595386

. display invt(25,.975)
2.0595386
ECON 644 Class 5

Magnitude Tests

(i) t-stat
(a) compute t-stat
(b) compare to critical-t

(ii) p-value
(a) compute p-value
(b) compare to significance level

(iii) confidence interval


(a) compute CI
(b) see where the CI is located relative to the magnitude
ECON 644 Class 5

Stata®: Magnitude Tests

Question 1: How does the effect of CEO tenure compare to 0?


. test (_b[ceoten]==0)

( 1) ceoten = 0
F( 1, 172) = 3.07
Prob > F = 0.0813

Note: F (1, n  k  1)  tn k 12 ; 3.07 = 1.752.


Note: p-value > 0.05, can’t reject H 0 , it’s possible the effect is zero.

Question 2: How does the effect of CEO tenure compare to 20?


. test (_b[ceoten]==20)

( 1) ceoten = 20
F( 1, 172) = 2.46
Prob > F = 0.1184

Note: p-value > 0.05, can’t reject H 0 , it’s possible the effect is 20.
ECON 644 Class 5

Magnitude Test with Confidence Interval

c [------- ̂ -------]

̂ statistically greater than c .


 greater than c . (This claim is made with 95% confidence.)

[---c--- ̂ --------]

̂ not statistically different from c .


 may be smaller, equal, or larger than c . (This claim is made
with 95% confidence.)
ECON 644 Class 5

Confidence Interval

. regress salary ceoten age grad mktval

Source | SS df MS Number of obs = 177


-------------+------------------------------ F( 4, 172) = 9.87
Model | 11348587.4 4 2837146.84 Prob > F = 0.0000
Residual | 49417377.4 172 287310.334 R-squared = 0.1868
-------------+------------------------------ Adj R-squared = 0.1678
Total | 60765964.7 176 345261.163 Root MSE = 536.01

------------------------------------------------------------------------------
salary | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ceoten | 10.55413 6.019706 1.75 0.081 -1.327879 22.43614
age | 1.649817 5.162111 0.32 0.750 -8.539427 11.83906
grad | -43.43346 82.2966 -0.53 0.598 -205.8748 119.0079
mktval | .0371649 .0063706 5.83 0.000 .0245903 .0497395
_cons | 578.0711 288.3528 2.00 0.047 8.905383 1147.237
------------------------------------------------------------------------------

Note: 1) Confidence interval for  ceoten is [-1.327, 22.436].


2) Data doesn’t reject 0 or 20 as possible values for  ceoten .
ECON 644 Class 5

Exact Confidence Interval

ˆ j   j
Theorem 4.2 says that ~ tnk 1 . This means that:
ˆ
se(  j )
 2 tails ˆ j   j 2 tails 
P tnk 1 ( )   tnk 1 ( )   1  
 se( ˆ j ) 
If we rearrange, we can get:
P ˆ j  tn2tails
k 1 ( )  se( ˆ
 j )   j  ˆ
 j  t n  k 1 ( )  se(  j )  1  
2 tails ˆ

and so an exact 1    confidence interval for the population


parameter  j is:
ˆ j  tn2tails ˆ
k 1 ( )  se(  j )
ECON 644 Class 5

Approximate Confidence Interval

If the sample size is large (meaning >120 obs), it's also


acceptable to work with an
approximate 1    confidence interval based on the standard
normal distribution.

Approximate 95% CI for  j : ˆ j  1.96  se( ˆ j )

(Why? Because as the tnk 1 's degrees of freedom ( n  k  1)


become large, the t distribution looks very much like the standard
normal distribution.)

Note: Stata reports the exact CI, not the approximate CI.
ECON 644 Class 5

(3) Sign, Size, Significance

When you get your regression estimates, think about their:

 sign direction (pos, neg)

 size econ significance (large, small)

 significance stat significance (high, low)


ECON 644 Class 5

The Triple S

Best case scenario:


right sign, large size, high significance.
Action: Start thinking about writing up the results.

Worst case scenario:


wrong sign, large size, high significance.
Action: Rethink model specification or data collection.

Intermediate scenarios:
right sign, large size, low significance.
Action: Is it because sample size too low? If so, you could still
make your case, but results look weak.

right sign, small size, so-so significance.


Action: Generally, if you believe the model is identified,
conclude the causal effect is just not there.
ECON 644 Class 5

Part III

(1) Scalars

(2) Estimated Marginal Means

(3) Making Regression Tables

(4) Exporting Regression Tables to Microsoft Word

(5) Maps: Spatial Data Visualization


ECON 644 Class 5

(1) Scalars

Scalars are numbers temporarily stored by Stata after executing


a command.

The most common scalar types are:

r() stored after general commands


e() stored after estimation commands

The list of scalars can be displayed after running the main


command with the follow-up commands:
. return list
. ereturn list
ECON 644 Class 5

r() scalars

. summarize salary

Variable | Obs Mean Std. Dev. Min Max


-------------+---------------------------------------------------------
salary | 177 865.8644 587.5893 100 5299

. return list

scalars:
r(N) = 177
r(sum_w) = 177
r(mean) = 865.8644067796611
r(Var) = 345261.1633281973
r(sd) = 587.5892811549554
r(min) = 100
r(max) = 5299
r(sum) = 153258
ECON 644 Class 5

e() scalars
. regress salary ceoten

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
------------------------------------------------------------------------------

. ereturn list

scalars:
e(N) = 177
e(df_m) = 1
e(df_r) = 175
e(F) = 3.650552266347093
e(r2) = .0204340385184175
e(rmse) = 583.2141027176848
e(mss) = 1241694.064223714
e(rss) = 59524270.68153899
e(r2_a) = .0148365187385228
e(ll) = -1377.380549813641
e(ll_0) = -1379.207694429356
e(rank) = 2
ECON 644 Class 5

Unpacking ̂ and t

. display e(rss)
59524271

. display e(df_r)
175

. display sqrt(e(rss)/e(df_r))
583.2141 Note: Confirms “Root MSE” in table.

. display _b[ceoten]
11.746129

. display _se[ceoten]
6.1477399

. display _b[ceoten]/_se[ceoten]
1.9106418 Note: Confirms “t” stat in table.
ECON 644 Class 5

(2) Estimated Marginal Means

The multiple regression model (MRM) estimates the empirical


relationship between salary and ceoten, while adjusting for
confounders age, grad, mktval.

. quietly regress salary ceoten age grad mktval

Note: Using quietly before the command serves to suppress the


estimation output.

After estimation, the coefficient estimates can be used to trace


out that empirical relationship, by computing marginal means.
ECON 644 Class 5

Margins Window

Statistics > Postestimation > Marginal effects, estimated means,


interactions ... > Marginal means and interaction analysis >
Estimated marginal means (least squares analysis)
ECON 644 Class 5

Estimated Marginal Means

In the margins window, choose:


- Type of covariate: Continuous
- Covariate: ceoten
- Analysis type: Marginal means of outcome
- Values to compute
estimates at: 0 5 10 15 20 25 30 35 40

Note: The range of variation of ceoten in the sample is [0,37], so


the last value 40 is outside that range. That estimate will be out-
of-sample.
. margins, at(ceoten=(0 5 10 15 20 25 30 35 40))

Note: A more elegant way to write the command:


. margins, at(ceoten=(0(5)40))

which says: range 0-40 with a step of 5.


ECON 644 Class 5

Estimated Marginal Means


. margins, at(ceoten=(0 5 10 15 20 25 30 35 40))
Predictive margins Number of obs = 177
Model VCE : OLS

Expression : Linear prediction, predict()

1._at : ceoten = 0

2._at : ceoten = 5

3._at : ceoten = 10

4._at : ceoten = 15

5._at : ceoten = 20

6._at : ceoten = 25

7._at : ceoten = 30

8._at : ceoten = 35

9._at : ceoten = 40

Delta-method
Margin Std. Err. t P>|t| [95% Conf. Interval]

_at
1 781.9084 62.57995 12.49 0.000 658.3848 905.432
2 834.679 44.0409 18.95 0.000 747.7488 921.6093
3 887.4497 42.12832 21.07 0.000 804.2946 970.6048
4 940.2203 58.49643 16.07 0.000 824.757 1055.684
5 992.991 82.95006 11.97 0.000 829.2599 1156.722
6 1045.762 110.2335 9.49 0.000 828.1769 1263.346
7 1098.532 138.6867 7.92 0.000 824.7853 1372.279
8 1151.303 167.7153 6.86 0.000 820.2578 1482.348
9 1204.074 197.0651 6.11 0.000 815.0962 1593.051
ECON 644 Class 5

Marginal Means Plot


. marginsplot

Note: The confidence intervals are wider at values of ceoten that


have fewer data points. In particular, at ceoten=40 which is out of
sample (meaning no data points at 40) estimate is less precise.
ECON 644 Class 5

(3) Making Regression Tables


Equation Form:
Eˆ ( salary | ceoten)  772.4 *** 11.74 * ceoten
(65.67) (6.14)

n  177 R  0.0204
2

Table Form:
Model: (1) (2) (3) (4)
salary salary salary salary
ceoten 11.75* 9.641 9.747 10.55*
(6.148) (6.536) (6.568) (6.020)
age - 5.277 5.408 1.650
(5.549) (5.589) (5.162)
grad - - 22.00 -43.43
(88.97) (82.30)
mktval - - - 0.0372***
(0.0063)
const. 772.4*** 941.4 471.5 578.1**
(65.68) (302.8) (314.0) (288.4)
Obs. 177 177 177 177
R2 0.020 0.025 0.026 0.187
Note: Standard errors in parentheses. * p<10%, ** p<5%, *** p<1%.
ECON 644 Class 5

Estimation Output Package

A nice package for reporting regression results is estout,


developed by Prof. Ben Jann (University of Bern).

Check if you already have the package installed.


. help estout

If not, download the package from the Internet:


. ssc install estout, replace
ECON 644 Class 5

Estimation Output Package

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

. eststo: quietly regress salary ceoten


(est1 stored)

. eststo: quietly regress salary ceoten age


(est2 stored)

. eststo: quietly regress salary ceoten age grad


(est3 stored)

. eststo: quietly regress salary ceoten age grad mktval


(est4 stored)
ECON 644 Class 5

Estimation Output Package

. esttab, se r2 star(* 0.10 ** 0.05 *** 0.01)


----------------------------------------------------------------------------
(1) (2) (3) (4)
salary salary salary salary
----------------------------------------------------------------------------
ceoten 11.75* 9.641 9.747 10.55*
(6.148) (6.536) (6.568) (6.020)

age 5.277 5.408 1.650


(5.549) (5.589) (5.162)

grad 22.00 -43.43


(88.97) (82.30)

mktval 0.0372***
(0.00637)

_cons 772.4*** 491.4 471.5 578.1**


(65.68) (302.8) (314.0) (288.4)
----------------------------------------------------------------------------
N 177 177 177 177
R-sq 0.020 0.025 0.026 0.187
----------------------------------------------------------------------------
Standard errors in parentheses
* p<0.10, ** p<0.05, *** p<0.01

. eststo clear
ECON 644 Class 5

(4) Exporting Regression Tables to Word

. esttab using "D:\UMD\ECON644\Tables\table1", rtf se r2 star(* 0.10


** 0.05 *** 0.01) replace
(output written to D:\UMD\ECON644\Tables\[Link])

. eststo clear

(1) (2) (3) (4)


salary salary salary salary
ceoten 11.75* 9.641 9.747 10.55*
(6.148) (6.536) (6.568) (6.020)

age 5.277 5.408 1.650


(5.549) (5.589) (5.162)

grad 22.00 -43.43


(88.97) (82.30)

mktval 0.0372***
(0.00637)

_cons 772.4*** 491.4 471.5 578.1**


(65.68) (302.8) (314.0) (288.4)
N 177 177 177 177
R2 0.020 0.025 0.026 0.187
Standard errors in parentheses
*
p < 0.10, ** p < 0.05, *** p < 0.01
ECON 644 Class 5

(5) Maps: Spatial Data Visualization

Basic types of spatial data:

 point data
o two coordinates:
longitude (horizontal) latitude (vertical)
o Example:
. list city state longitude latitude in 31/33

+------------------------------------------------------+
| city state longitude latitude |
|------------------------------------------------------|
31. | Tacoma Washington -122.4443 47.2529 |
32. | Rancho Cucamonga California -117.5931 34.1064 |
33. | Montgomery Alabama -86.3077 32.3792 |
+------------------------------------------------------+

 polygon data
o a polygon is an enclosed area
o data contained in “shapefiles”
o shapefiles for the US can be found at the Census page:
[Link]
[Link]
ECON 644 Class 5

Spatial Point Map

From the Census website, download the shapefiles with state


boundaries. They are contained in this compressed file:
cb_2023_us_state_500k.zip

The compressed file first has to be unzipped:


. unzipfile cb_2023_us_state_500k.zip

The shapefiles have to be converted into Stata format:


. spshape2dta cb_2023_us_state_500k, replace

Now the Stata version of the shapefile can be uploaded.


. use cb_2023_us_state_500k.dta, clear
ECON 644 Class 5

Spatial Point Map

The Stata command grmap will now graph the map.


. grmap if inlist(STUSPS,"AK","HI","AS","GU","MP","PR","VI") == 0,
point(data([Link]) xcoord(longitude) ycoord(latitude) size(small))
ocolor(gs12)

Note: Non-contiguous US territories are removed, for simplicity.


Note: To draw the base map (the contour of the US states) the
command grmap uses the shapefile cb_2023_us_state_500k.dta and
then superimposes on it the coordinates of the cities (longitude,
latitude) which are contained in the dataset [Link].
ECON 644 Class 5

Spatial Polygon Map

Question: Which states have the highest concentration of CEO-


run firms?

Answer: Compute the number of firms in each state and plot it


on a map with color shades indicating the concentration levels.

Upload the CEO dataset.


. use [Link], clear

Compute the frequency of CEO by state.


. contract state

Merge the frequency variable with the shapefile, after renaming


the state identifier to match the one in the shapefile.
. rename (state _freq) (NAME numceo)
. merge 1:1 NAME using cb_2023_us_state_500k.dta
ECON 644 Class 5

Spatial Polygon Map

The Stata command grmap will now graph the map.


. grmap numceo if inlist(STUSPS,"AK","HI","AS","GU","MP","PR","VI") == 0,
clmethod(custom) clbreaks(1 2 4 10 40)

(10,40]
(4,10]
(2,4]
[1,2]
No data

Note: This is also called a “choropleth map.”


Note: The command grmap graphs the levels of the variable numceo
(number of CEOs by state) based on a custom classification
method that defines four intervals: [1,2], [3,4], [5,10], [11,40].

You might also like