Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: __000000 not found


From   "Rubil Ivica" <[email protected]>
To   <[email protected]>
Subject   RE: st: __000000 not found
Date   Mon, 17 Dec 2012 14:17:34 +0100

Yes, it's a user-written command and here's the code:

// elpp, varname() weights1() weights2() file1() file2() pline()
program elpp, rclass 
version 10.1
	syntax, varname(string) weights1(string) weights2(string)
file1(string) ///
			file2(string) PLINE(real) [graph] 
		
		local data `varname'
		local wagi1 "`weights1'"
		local wagi2 "`weights2'"
				
		qui {
				
		tempname bal
		tempfile `bal'
		
		local year1 = substr("`file1'",5,4) 
		local year2 = substr("`file2'",5,4) 
		
		use "`file1'", clear
		
		total `wagi1'
		mat r1=e(b)
		scalar totw=r1[1,1]
				
		count
		scalar nobs_1=r(N)
		tempvar poor
		gen `poor'=0
		replace `poor'=1 if `data' < `pline'
		mean `poor' [aw=`wagi1']
		mat r1=e(b)
		scalar headcount=r1[1,1]
		count if `data' < `pline'
		scalar poor_no=r(N)
		keep `data' `wagi1'
		
		rename `data' `data'1
		save "`bal'", replace
		
		use "`file2'", clear
		keep `data' `wagi2'
		rename `data' `data'2
		merge using "`bal'"
						
		sum `data'1 [aw=`wagi1'], meanonly
		scalar m1=r(mean)
		sum `data'2 [aw=`wagi2'], meanonly
		scalar m2=r(mean)
		
		return scalar m1=m1
		return scalar m2=m2
		
		sort `data'1
		//tempname invF2

		cumul `data'1 [aw=`wagi1'], generate(cum_`data'1) equal
		 invcdf cum_`data'1 [aw=`wagi2'], ref(`data'2) g(invF2)
		
		cumul `data'2 [aw=`wagi2'], generate(cum_`data'2) equal
		sort cum_`data'2
		gen invF2_2 = `data'2
		sort `data'1
		
		tempvar q f_watts k_watts f_fgt1_pi f_fgt1_k
f_fgt1_k_deno f_fgt2_pi f_fgt2_k_nom f_fgt2_k_denom
		gen double `q' = m1/(m2-m1)*(invF2/`data'1 -1)

			
		// estimate for Watts

		gen double `f_watts'=0 
		replace `f_watts'=`q'-1 if `data'1 < `pline'
		mean `f_watts' [aw=`wagi1']
		mat w=e(b)
		tempname w1 w2 w3 w4 w5 w6 w7 w8 w9
		scalar `w1'=w[1,1]
		return scalar pi_watts=`w1'
			
		gen double `k_watts'=0
		replace `k_watts'=`q' if `data'1 < `pline'
		mean `k_watts' [aw=`wagi1']
		mat w=e(b)
		scalar `w2'=w[1,1]
		return scalar kappa_watts=`w2'/(headcount)
		
	
		// estimate for headcount index
		
		kdens `data'1 [aw=`wagi1'], at(`data'1) generate(den)
nograph
		local pline_ind=poor_no+1
		scalar den_at_pline=den[`pline_ind']
		return scalar pi_headcount =
`pline'*(`q'[`pline_ind']-1)*den_at_pline
		return scalar kappa_headcount = `q'[`pline_ind']
		
		// estimate for FGT1 - normalized poverty deficit
		
		gen double `f_fgt1_pi' =0
		replace `f_fgt1_pi' = `data'1/`pline'*(`q'-1) if `data'1
< `pline'
		mean `f_fgt1_pi' [aw=`wagi1']
		mat w=e(b)
		scalar `w3'=w[1,1]
		return scalar pi_fgt1=`w3'
		
		gen double `f_fgt1_k' = 0
		replace `f_fgt1_k' = `data'1 * `q' if `data'1 < `pline'
		mean `f_fgt1_k' [aw=`wagi1']
		mat w=e(b)
		scalar `w4'=w[1,1]
		
		gen double `f_fgt1_k_deno'=0
		replace `f_fgt1_k_deno' = `data'1 if `data'1 < `pline'
		mean `f_fgt1_k_deno' [aw=`wagi1']
		mat w=e(b)
		scalar `w5'=w[1,1]
		return scalar kappa_fgt1=`w4'/`w5'
		
		// estimate for FGT2 - squared poverty gap
		gen double `f_fgt2_pi' =0
		replace `f_fgt2_pi' =
2*`data'1/`pline'*(1-`data'1/`pline')*(`q'-1) if `data'1 < `pline'
		mean `f_fgt2_pi' [aw=`wagi1']
		mat w=e(b)
		scalar `w6'=w[1,1]
		return scalar pi_fgt2=`w6'
		
		gen double `f_fgt2_k_nom'=0
		replace `f_fgt2_k_nom' =
2*`data'1*(1-`data'1/`pline')*`q' if `data'1 < `pline'
		mean `f_fgt2_k_nom' 
		mat w=e(b)
		scalar `w7'=w[1,1]
		
		gen double `f_fgt2_k_denom' = 0
		replace `f_fgt2_k_denom' = 2*`data'1*(1-`data'1/`pline')
if `data'1 < `pline'
		mean `f_fgt2_k_denom' 
		mat w=e(b)
		scalar `w8'=w[1,1]
				
		ratio `f_fgt2_k_nom'/`f_fgt2_k_denom' [pw=`wagi1']
		mat w=e(b)
		scalar `w9'=w[1,1]
		
		return scalar kappa_fgt2=`w9'
		
		// graph
		if "`graph'"=="graph" & "`savegraph'"=="" {
			gen qq=`q'
			gen bench =1
			gen cumpop = sum(`wagi1')/totw*100 if `data'1!=.
			sum `q', meanonly
			twoway mspline qq cumpop, legend(off)
title("Pattern of growth") ///
			ytitle("Growth rates") xtitle("Cumulative
percentage of population") ///
			xlabel(#11) yscale(titlegap(5))
xscale(titlegap(5))  || line bench cumpop
		}
		
		
		if (m2/m1) <1 {
		noi dis 
		noi dis as error " Warning! There was negative income
growth during the period"
		noi dis as error " growth pattern curve and all
coefficients have non-standard meaning"
		noi dis as error " and have been transformed, see
Essamah and Lambert (2009), p. 8, 17)"
		
		return scalar pi_watts= -return(pi_watts)
		return scalar pi_headcount = -return(pi_headcount)
		return scalar pi_fgt1= -return(pi_fgt1)
		return scalar pi_fgt2= -return(pi_fgt2)
		return scalar kappa_watts=1/return(kappa_watts)
		return scalar kappa_headcount=1/return(kappa_headcount)
		return scalar kappa_fgt1=1/return(kappa_fgt1)
		return scalar kappa_fgt2=1/return(kappa_fgt2)
		}
		
		} //end qui


dis _n as res "Essama-Nssah and Lambert pro-poorness indices"
di _n as text "Mean income in period 1 = " as res return(m1)
di as text "Mean income in period 2 = " as res return(m2)
di _n as text "Additive index for the headcount ratio: " as res
return(pi_headcount)		
di    as text "Additive index for the FGT(1) index     " as res
return(pi_fgt1)
di    as text "Additive index for the FGT(2) index     " as res
return(pi_fgt2)
di    as text "Additive index for the Watts index      " as res
return(pi_watts)

di _n as text "Ratio index for the headcount ratio     " as res
return(kappa_headcount)		
di    as text "Ratio index for the FGT(1) index        " as res
return(kappa_fgt1)
di    as text "Ratio index for the FGT(2) index        " as res
return(kappa_fgt2)
di    as text "Ratio index for the Watts index         " as res
return(kappa_watts)
		
end // EssamaLambert





--
Ivica Rubil
Ekonomski institut || The Institute of Economics, Zagreb
Trg J. F. Kennedyja 7, 10 000 Zagreb, Croatia
tel. +385-1-2362-269 || fax. +385-1-2335-165
[email protected] || www.eizg.hr


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 17. prosinac 2012 14:10
To: [email protected]
Subject: Re: st: __000000 not found

-elpp- is presumably some user-written command. You should explain
where you got it.

__000000 is the name of a temporary variable. I've not tried looking
inside -elpp- or even finding the file -- as above, that's your job to
explain -- but on this evidence -elpp- is not (easily) bootstrappable.
Its use of -file*()- options seems to hint at that too.

Nick

On Mon, Dec 17, 2012 at 12:53 PM, Rubil Ivica <[email protected]> wrote:

> Is there anybody who used the -elpp- for estimating the Essama-Nssah &
> Lambert pro-poor indices? The command runs well but when I try to
obtain
> bootstrap standard errors I get a strange error message. Here are the
> code and what Stata returns:
>
>
>
> bootstrap pi_hc=r(pi_headcount): elpp, varname(y) pline(849) ///
>                                  weights1(w0) weights2(w1) ///
>                                  file1(test_alb_y0) file2(test_alb_y1)
> (running elpp on estimation sample)
>
> Bootstrap replications (50)
> ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
> ..................................................    50
> variable __000000 not found
> r(111);
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index