Stata commands Flashcards Preview

Applied Quantitative Research Methods > Stata commands > Flashcards

Flashcards in Stata commands Deck (7):
1

How do you create a quadratic term for the variable age?

generate agesq = age^2

2

How do you create the natural logarithm of the variable wage?

generate logwage = log(wage)

3

How do you create an interaction variable equal to the product of the variables x2 and x2?

generate x2_x3 = (x2*x3)

4

How do you create a ratio of two variables such as wages over hours (hourly wages)?

generate hrwage = wage/hours

5

How do you create a dummy variable which equal 1 when the variable year is equal to or greater than 47, and zero if otherwise?

generate D = (year>=47)

This creates a dummy variable Di, equal to 1 for observation I if the condition in parentheses is true. Di = 0 if the condition in the parentheses doesn't hold (i.e. year<47)

6

How do you create a multiple linear regression which regresses the outcome variable, y, on three regressors, x1, x2 and x3?

regress y x1 x2 x3

7

How do you create a multiple linear regression with heteroscedasticity-robust standard errors which regresses the outcome variable, y, on three regressors, x1, x2 and x3?

regress y x1 x2 x3, robust

(note: the comma is important!)