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]

st: Adjusted median and standard error using quantile regression


From   Pham Ngoc Minh <phamngocm@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Adjusted median and standard error using quantile regression
Date   Sun, 24 Feb 2013 11:30:02 +0900

Dear Statalists,

I wish to obtain median values of depvar (redmeat) by indepvar
(bevcat) coded 1, 2, 3 with adjustment for age and sex, and
corresponding standard errors. I also mean to have P for trend, and
wrote the following codes:

Approach 1:
xi: bsqreg redmeat age sex i.bevcat, reps(1000)
adjust age sex, by(bevcat) se
bsqreg redmeat age sex bevcat // P for trend

Approach 2:
xi: bsqreg redmeat age sex i.bevcat, reps(1000)
predictnl yhat = xb(#1), se(sevar)
tabstat yhat sevar, by(bevcat) stats(median)

Conceivably, adjusted medians and SEs are different between the two
methods. I'm not sure about either approach 1 or 2 is correct. I'd
appreciate your suggesting better methods. By the way, regarding
approach 2, command {predict} doesn't work with 'stdp' option after
running quantile regression (Why?). Thank you for your help in
advance.

Ngoc Minh Pham

Thai Nguyen University College of Medicine and Pharmacy, Faculty of
Public Health, Vietnam.





On Sat, Feb 23, 2013 at 3:59 AM, Marcelo Lafleur <lafleurm@un.org> wrote:
> Dear listmembers,
>
> I'm attempting to estimate elasticities using a logit model:
>
> . logit neting1 gastpc atenpre##saneamiento
> . margins, eyex(*) atmeans
>
>         ERROR: "factor variables not allowed in option eyex()"
>
> However, using dydx, there is no problem:
> . margins, dydx(*) atmeans
>
> To get around this problem, I have created the categorical variables of
> interaction using either the command -xi- or  -tabulate ,generate()-.Then
> I run the same -logit- using the categorical variables created:
>
> . xi i.atenpre|saneamiento, prefix(_S)
>
> . logit neting1 gastpc atenpre saneamiento  _SateXsanea_1
> . margins, eyex(*) atmeans
>
>         This produces the output.
>
> I'm not 100% sure if this is a statistical/mathematical issue, or just a
> limitation of the margins command using factor variables. Needless to say,
> this is annoying as it requires preprocessing many variables in my model
> to create the proper categorical variables, which could easily be done
> with factor variables. I spent an entire afternoon trying to figure out
> what -xi- is actually outputting and how to make it equivalent to the
> var1##var2 option (as opposed to the var1#var2 option).
>
> Hope someone can shed light on this issue.
>
> Stata version:
> Stata/SE 12.1 for Windows (32-bit)
> Revision 30 Jan 2013
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index