[go: up one dir, main page]

0% found this document useful (0 votes)
134 views4 pages

Using Stata Chapter 2

Uploaded by

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

Using Stata Chapter 2

Uploaded by

kkjpj1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Chapter 2: UE Chapter2

The Stata topics covered in Chapter 2 are:

1) Multivariate regression estimation


2) TSS, ESS, RSS, R2 and Adjusted R2 (or R2)

2.1 Multivariate Regression Estimation

Chapter 2 in Using Econometrics formally introduces Ordinary Least Squares (OLS)


to do simple regressions (regressions with one independent variable). It then
extends OLS to multiple regression, models with two or more independent
variables.

We already have seen how to estimate a simple regression in Stata:

regress dependentvariable independentvariable

Nicely, to have Stata estimate a multivariate model with OLS (multiple regression),
the syntax is very similar. The only difference is you add more independent
variables to the regress command. For example, if you had two independent
variables, you would give the command:

regress dependentvariable independentvariable1 independentvariable2

Let’s take the financial aid model from Section 2.2 in Using Econometrics. Equation
2.9 on page 43 proposes:

FINAID i=β 0 + β 1 PARENT i + β 2 HSRANK i + ε i

where:
FINAID: the amount of financial aid (in dollars per year) the ith
student received
PARENT: the amount (in dollars per year) that the parents of the
ith student are judged able to contribute to college
expenses.
HSRANK: the ith student’s GPA rank in high school, measured as a
percentage (ranging from a low of 0 to a high of 100).

The data set (presented in Table 2.2 of Using Econometrics) is available online at the
Using Econometrics student companion website
(http://www.pearsonhighered.com/studenmund) and is named FINAID2.dta.

Using Stata 2-1


After loading the data in Stata, to perform the estimation, enter the command:

regress FINAID HSRANK PARENT

Figure 2.1 presents the results.

FIGURE 2.1

Nicely, after rounding, the coefficient estimates (in the column titled “Coef.”) match
Equation 2.10 in Using Econometrics. Also, take note that Stata reports the number
of observations used in the regression (top right labeled “Number of obs”). This
regression had 50 observations.

In this example, we have two independent variables (HSRANK and PARENT). There
is no reason we can’t have three or four or five or many more. To include those in
the regression estimation, you'd just add them to the “regress” statement in Stata.

2.2 TSS, ESS, RSS, R2 and Adjusted R2 (or R2)

From multivariate regression in Stata, it is just a small step to taking on TSS, ESS,
RSS, R2 and Adjusted R2. Why? Because when Stata does an OLS estimation it
automatically produces each. You just have to know where to look.

To demonstrate this, let’s use the mozzarella cheese example from Section 2.5 in
Using Econometrics. We can replicate the results found in Equation 2.17 using the
data set named MOZZCON2.dta (available for download at
http://www.pearsonhighered.com/studenmund).

The model estimated is:

Using Stata 2-2


MOZZARELLA t =β 0 + β 1 INCOME t + β 2 DROWNINGS t +ε t

where:
MOZZARELLA: U.S. per capita consumption of mozzarella cheese (in
pounds) in year t
INCOME: U.S. real disposable per capita income (in thousands of
dollars) in year t
DROWNINGS: U.S. deaths due to drowning after falling out of a fishing
boat in year t

The command in Stata to estimate this model with OLS is:

regress MOZZARELLA INCOME DROWNINGS

Figure 2.2 displays the results.

FIGURE 2.2

As expected, the coefficients from Stata match Equation 2.17 in Using Econometrics
(with a bit of rounding).

Let’s consider TSS, ESS, and RSS. All three are reported in the Stata output in Figure
2.2. TSS is indicated by the blue arrow (2.63600104—talk about precise!). The red
arrow points to RSS (0.05751133) and the green arrow points to ESS (2.57848971).

The “Total SS” in the Stata output is TSS.

The “Residual SS” in the Stata output is RSS.

Using Stata 2-3


The “Model SS” in the Stata output is ESS.

While TSS, ESS, and RSS are interesting, they lead to something more interesting: R2
(recall R2 = ESS/TSS). Since Stata provides both ESS and TSS, you could calculate R2
directly. But, Stata calculates R2 (and Adjusted R2) for you. Figure 2.3 shows where
to find R2 (blue arrow) and Adjusted R2 (red arrow) in Stata output (continuing with
the mozzarella model example).

FIGURE 2.3

If you are inclined, you could use the Stata-provide ESS and TSS to confirm what
Stata is reporting. Just for fun, let’s do this.

2 ESS 2.57848971
R= = =0.9781823569
TSS 2.63600104

Rounding to four decimal places matches exactly what Stata calculated: 0.9782. You
can follow a similar approach to confirm the value for Adjusted R2 (I’ll leave that fun
for you!)

Using Stata 2-4

You might also like