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]
st: RE: Standard errors of certain quantities after estimating a system of equations
From
Murat Genc <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: Standard errors of certain quantities after estimating a system of equations
Date
Thu, 7 Mar 2013 09:48:29 +0000
Dear Statalist,
I've estimated a system of 24 equations and I am calculating some quantities using the estimated coefficients. The formula for the quantities I calculate involves some scalars (which are actually average values of some variables that enter the estimated equations) and the estimated coefficients. My goal is to obtain the standard errors of these quantities. So, I use the predictnl comment. This works fine, but it takes a long time. (I have 24*24 quantities, and it takes about 20 hours.) The set of commands I use is
forvalue i=1/4 {
forvalue j=1/4 {
if `i'==`j'{
nlcom e`i'_`j': -1+(1/w`i'bar)*((pdfp`i'bar*coeflnp`j'eq`i'*(w`i'hatbar-[w`i']pdfp`i'*pdfp`i'bar)/cdfp`i'bar)+cdfp`i'bar*([w`i']shlnp`j'`i'-[w`i']lfp`i'*w`j'bar)-[w`i']pdfp`i'*pdfp`i'bar*coeflnp`j'eq`i'*pr`i'bar),post
}
else {
nlcom e`i'_`j': (1/w`i'bar)*((pdfp`i'bar*coeflnp`j'eq`i'*(w`i'hatbar-[w`i']pdfp`i'*pdfp`i'bar)/cdfp`i'bar)+cdfp`i'bar*([w`i']shlnp`j'`i'-[w`i']lfp`i'*w`j'bar)-[w`i']pdfp`i'*pdfp`i'bar*coeflnp`j'eq`i'*pr`i'bar),post
}
}
}
[w`i'] refers to the estimated equation.
My question is whether there is a better way of doing this so that it won't take such a long time.
I saw the question about "Using Delta Method with Estimated Marginal Effects from a Tobit Model" yesterday. The solution suggested looked very neat, and I tried to do something similar but it didn't work. The solution suggested by Maarteen there used the margins command in combination with nlcom. Based on that I tried the following
margins, dydx(*) predict(equation(w1)) post nlcom e1_2: -1+(1/w1bar)*((pdfp1bar*coeflnp2eq1*(w1hatbar-[w1]pdfp1*pdfp1bar)/cdfp1bar)+cdfp1bar*([w1]shlnp21-[w1]lfp1*w2bar)-[w1]pdfp1*pdfp1bar*coeflnp2eq1*pr1bar)
to do the calculation for one case. But when I try it I get an error message that says "option nlcom not allowed."
I'll appreciate any suggestion that will make the calculations faster.
Murat
*
* 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/