Thank you, Stas. Will follow up.
Regards,
Ramani
Stas Kolenikov <[email protected]> wrote:
> --- In [email protected], Ramani Gunatilaka
> > I am trying to apply the Shapley decomposition method to household
> > consumption data.
> > I am wondering if there is a short cut to do the following subroutine.
>
> I have -shapley- ado-file available from my web-page (the server is down
> sometimes; there should be a copy at SSC although it might be quite old).
>
> The best way to proceed within the context of that program is to generate
>
> foreach x of varlist <<your variables here>> {
> gen VVV`x' = `x'
> }
>
> then
>
> regress depvar VVV*
>
> which would give you the coefficients to use later, and then run my
> -shapley- with a subroutine that would do something like
>
> cap prog drop MyShapley
> prog define MyShapley
>
> syntax varlist
>
> foreach x of varlist <<your variables here again>> {
> replace VVV`x' = `x'
> }
> foreach x of varlist `varlist' {
> sum `x'
> replace VVV`x' = r(mean)
> }
> cap drop predicted
> predict predicted
>
> * do whatever you need with that predicted variable
>
> end
>
> --- Stas Kolenikov
> -- Ph.D. student in Statistics at UNC-Chapel Hill
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/