Stata commands Flashcards

1
Q

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

A

generate agesq = age^2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

generate logwage = log(wage)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

generate x2_x3 = (x2*x3)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

generate hrwage = wage/hours

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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?

A

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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

regress y x1 x2 x3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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?

A

regress y x1 x2 x3, robust

note: the comma is important!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly