version 6 set more off capture log close clear set memory 50m log using c:\documents\ellison\demand.log,replace use c:\documents\ellison\gasoline.dta ********************** *Data set at a glance ********************** gen tmp=year1+year2+year3+year4+year5+year6 assert tmp==1 drop tmp gen tmp=da1+da2+da3+da4+da5+da6+da7+da8+da9 tab tmp drop tmp gen tmp=da1+da2+da3+da4+da5+da6+da7+da8+da9+db1+db2+db3+db4+db5+db6+db7+db8 tab tmp drop tmp sum lq lp ly da1-da9 db1-db8 year1-year6 *The data set contains 18,110 observations on the consumption *of gasoline, income and gasoline price. Data are annual. *Dummy variables identify six years, and 18 geographic locations *(9 according to classification "a", 8 to "b", 1 base location). ****************** *Demand estimates ****************** reg lq lp ly year1-year6,robust noconstant reg lq lp ly year1-year6 da1-da9 db1-db8,robust noconstant gen q=exp(lq) gen p=exp(lp) gen y=exp(ly) reg q p y year1-year6,robust noconstant reg q p y year1-year6 da1-da9 db1-db8,robust noconstant ******************* *Kernel regression ******************* net from http://fmwww.bc.edu/RePEC/bocode/k net describe kernreg1 net install kernreg1 net get kernreg1 kernreg1 lq lp,k(6) np(100) kernreg1 q p,k(6) np(100) *The option k(6) specifies that the weight function (kernel) *is gaussian. The option np(100) specifies that the number of *equally spaced points (grid) is 100. For further information *about kernreg, see Stata Technical Bulletin N.30. log close