open cig_ch10.gdt # real avg price including sales tax ravgprs = avgprs / cpi # real avg cig-specific tax rtax = tax / cpi # real average total tax rtaxs = taxs / cpi # real average sales tax rtaxso = rtaxs - rtax # logs of consumption, price, income lpackpc = log(packpc) lravgprs = log(ravgprs) perinc = income / (pop*cpi) lperinc = log(perinc) # restrict sample to 1995 observations smpl --restrict year==1995 # Equation (10.16) by tsls list xlist = const lravgprs lperinc list zlist = const rtaxso rtax lperinc tsls lpackpc xlist ; zlist --robust # setup for gmm matrix Z = { zlist } matrix W = inv(Z'Z) series e = 0 scalar b0 = 1 scalar b1 = 1 scalar b2 = 1 gmm e = lpackpc - b0 - b1*lravgprs - b2*lperinc orthog e ; Z weights W params b0 b1 b2 end gmm