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]

st: Adjusted median and standard error using quantile regression


From   Pham Ngoc Minh <[email protected]>
To   [email protected]
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 <[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index