Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: AW: decomposition concentration index


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: AW: decomposition concentration index
Date   Thu, 10 Jun 2010 14:54:44 +0200

<> 

No need for a -matrix- containing a -scalar- in the first place:

*************
sysuse auto, clear

gl xvar mpg price 
dprobit foreign $xvar

mat l e(dfdx)
matrix dfdx=e(dfdx)
sca drop _all

foreach x of global xvar {
	sca b_`x' = dfdx[1,`=colnumb(dfdx,"`x'")']
	di _n(2)
	scalar list
}
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Martin Weiss
Gesendet: Donnerstag, 10. Juni 2010 14:19
An: statalist@hsphsun2.harvard.edu
Betreff: st: AW: decomposition concentration index


<> 

Try the 

*************
colnumb()
*************

function for - mat b_`x' = dfdx[1,"`x'"]-


HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von ecreceb@unex.es
Gesendet: Donnerstag, 10. Juni 2010 14:01
An: statalist@hsphsun2.harvard.edu
Betreff: st: decomposition concentration index


I am trying to decompose the concentration index (Wagstaff et al, 1997)
using the below procedure in stata 11. But, after run the model and obtain
elasticities, variables are not recognize in the step: mat b_`x' =
dfdx[1,"`x'"]

How can I do?

Thank you

global xvar "age1 age2 sexo longillness symptom problem symptom2 chronic2
depression badorienti adl iadl phhealth"

global zvar "alone homecare physicactiv isced1 isced2 isced3 isced4 seggen
employed lnrentahogeq"

dprobit frecgenprac $xvar $zvar
matrix dfdx=e(dfdx)

sca need=0
foreach x of global xvar {
qui {
mat b_`x' = dfdx[1,"`x'"]
sca b_`x' = b_`x'[1,1]
corr `x', c
sca cov_`x' = r(cov_12)
sum `x'
sca m_`x' = r(mean)
sca elas_`x' = (b_`x'*m_`x')/m_frecgenprac
sca CI_`x' = 2*cov_`x'/m_`x'
sca con_`x' = elas_`x'*CI_`x'
sca prcnt_`x' = con_`x'/CI
sca need=need+con_`x'
}
di "`x' elasticity:", elas_`x'
di "`x' concentration index:", CI_`x'
di "`x' contribution:", con_`x'
di "`x' percentage contribution:", prcnt_`x'
}





*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index