Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Murat Genc <murat.genc@otago.ac.nz> |
To | "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: how to use margins to evaulate an estimated function at two different sets of values for covariates and obtain the standard error of a function of the difference between the two |
Date | Mon, 8 Jul 2013 09:03:33 +0000 |
Dear Statalisters, I'm using Stata 12. I have estimated a system of 24 equations. Let's say that the equations are denoted by s`i'. I am interested in predicting and obtaining the standard errors of the proportionate change in (s`i')*food_exp)/price_f`i' when some covariates are changed (and where food_exp and price_f are some variables in the data set). I calculated the initial predictions by forvalue i=1/24 { est restore surebootall margins,expression((xb(s`i')*food_exp)/price_f`i') noesample post est store initial`i' } and the new predictions by forvalue i=1/24 { est restore surebootall margins,expression((xb(s`i')*food_exp)/price_f`i') noesample post est store new`i' } Using the new values of the covariates. So, what I need is the standard error of (new`i'- initial`i')/ initial`i'. This is where I get stuck, because I cannot use two estimates on the same command (such as nlcom). I thought of using a single margins command with at() option to specify the new values for the covariates, but at() option expects a number for the covariate. That makes it impossible, because these values are all different for every observation in the sample and I cannot possible enter them one by one. I tried creating scalars and using something like at(var1=scalar1), but that does not work since scalar1 is not a number. Does anyone have a suggestion? Many thanks in advance. Murat Dr M Genç Department of Economics Research Fellow University of Otago and Institute for the Study of Labor (IZA) P O Box 56 Bonn, Germany Dunedin 9054, New Zealand _______________________________________________ E-Mail: murat.genc@otago.ac.nz Phone: +64 3 479 8644 Fax: +64 3 479 8174 FFFFFFF Web: <www.otago.ac.nz/economics> * * 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/