Stata/Tobit and Selection Models

From Wikibooks, open books for an open world
Jump to navigation Jump to search


Censoring[edit | edit source]

We observe the full marginal distribution of x but we only observe the distribution of y above or below a given threshold.

clear
set obs 1000
gen u = invnorm(uniform())
gen x = invnorm(uniform())
gen y = x + u
su
replace y=0 if y < 0
su 
hist y 
#delimit ; 
tw (sc y x, m(Oh) msize(small) ) 
	(sc ycens x , m(Oh) msize(small) )
	(lfit y x, lw(thick)) 
	(lfit ycens x, lw(thick)) ; 
#delimit cr

Estimation :

eststo clear 
eststo : reg y x
eststo : tobit y x , ll(0) 
esttab , se

We can also have a two limit tobit model :

*** Data Generating Process ***
clear
set obs 1000
gen u = invnorm(uniform())
gen x = invnorm(uniform())
gen y = x + u
su
replace y=-2 if y < -2
replace y=2 if y > 2
su 
hist y 
*** Estimation ***
eststo clear 
eststo : reg y x
eststo : tobit y x , ll(-2) ul(2)
esttab , se

Truncation[edit | edit source]

We only observe the distribution of x and y if y is above or below a given threshold.


clear
set obs 1000
gen u = invnorm(uniform())
gen x = invnorm(uniform())
gen y = x + u 
replace y = . if y > 0 /* drop some observations*/
eststo clear 
eststo : reg y x
eststo : truncreg y x , ul(0)
esttab , se

Selection Models[edit | edit source]

heckman estimates the Heckman selection model.

clear
set obs 1000
gen u = invnormal(uniform())
gen v = 1 + u + invnormal(uniform())
gen x = invnormal(uniform())
gen z = invnormal(uniform())
gen d = (1 + x + z + v > 0)
gen ystar = 1 + x + u 
gen y = ystar if d
heckman y x, select(d = z x)
test x = 1