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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: generate standard errors for efficiency estimates in xtfrontier?


From   Scott Merryman <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: generate standard errors for efficiency estimates in xtfrontier?
Date   Mon, 19 Apr 2010 16:53:20 -0500

Take a look at:

Horrace, William and Peter Schmidt (1996) "Confidence Statements for
Efficiency Estimates from Stochastic Frontier Models" The Journal of
Productivity Analysis, 7, 257-282.

I believe the following should work as a rough take.

Scott


*! version 1.0.0  19apr2010
*! Developed from Stata's -xtfront_p- version 1.1.0  04jun2009
program define xtfront_pci
	version 11
	syntax namelist(max=1 ) [if] [in]
	marksample touse
	local varn  `namelist'

        local y=e(depvar)
        local ivar=e(ivar)
        local by "by `ivar'"
        if "`e(model)'" == "tvd" {
                local tvar=e(tvar)
        }
        if "`e(function)'" == "cost" {
		local COST=-1
	}
        else	local COST=1

        sort `ivar' `tvar'
                                        /* Predict xb, and get ei */
        tempvar xb res
        qui _predict double `xb' if e(sample), xb
        qui gen double `res'=`y'-`xb' if e(sample)

        tempname sigma_u2 sigma_v2 eta mu
        scalar `sigma_u2' = e(sigma_u)^2
        scalar `sigma_v2' = e(sigma_v)^2
        scalar `mu' = [mu]_cons

        tempvar eta_e eta2 mui sigmai2 expu T zl zu
        if "`e(model)'" == "tvd" {
                scalar `eta' = [eta]_cons
                qui `by': egen double `T' = max(`tvar') if e(sample)
                local td `:char _dta[_TSdelta]'
                if "`td'" == "" {
                	local td 1
                }
                local eta_it (exp(-`eta'*(`tvar'-`T')/`td'))
        }
        else {
                local eta_it 1
        }

        quietly {
                `by': gen double `eta_e' = cond( _n==_N, /*
                */ sum(`eta_it'*`res'), . )
                `by': gen double `eta2' = cond( _n==_N, /*
                */ sum(`eta_it'^2), . )
                gen double `mui' = (`mu'*`sigma_v2' /*
                */ - `COST'*`eta_e'*`sigma_u2')/(`sigma_v2' /*
                */ + `eta2'*`sigma_u2')
					gen double `sigmai2' = `sigma_v2'*`sigma_u2' /*
                */ /(`sigma_v2' + `eta2'*`sigma_u2')
                `by': replace `mui' = `mui'[_N] if `touse'
                `by': replace `sigmai2' = `sigmai2'[_N] if `touse'

                local sigmai (sqrt(`sigmai2'))
        }

	gen double `zl'  = invnormal(1 -
(.05/2)*[1-normal(-`eta_it'*`mui'/sqrt(`sigmai2'))])
	gen double `varn'_l= max(0,exp(-`eta_it'*`mui' - `zl'*sqrt(`sigmai2')))
	gen double `zu'  =
invnormal((.05/2)*[1-normal(-`eta_it'*`mui'/sqrt(`sigmai2'))])
	gen double `varn'_u = min(1,exp(-`eta_it'*`mui' - `zu'*sqrt(`sigmai2')))
	label var `varn'_l "Lower bound technical efficiency"
	label var `varn'_u "Upper bound technical efficiency"

end


On Mon, Apr 19, 2010 at 7:45 AM,  <walkercu@msu.edu> wrote:
> Hello everyone,
>
> I am using -xtfrontier- to estimate technical efficiency, and I would
> like to include the standard errors for the efficiency terms predicted.
>
> I used the following commands:
>
> .xtfrontier /depvar independentvars/, ti
> .predict efficiency, te
>
> But I can't figure out how to generate standard errors for the point
> estimates.  After reading through the help sections, I tried using
> -predictnl-, with the following command:
>
> .predictnl efficiency=predict(te), standerror(se)
>
> But I received an error message:
> "expression is a function of possibly stochastic quantities other
> than e(b)"
>
> I've searched the archives and the stata help files and haven't been
> able to find an answer to this.
>
> Thanks,
> Curtis
>

*
*   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