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]

From |
Steven Samuels <sjsamuels@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Obtaining 95%CI for marginal effect |

Date |
Mon, 7 Feb 2011 09:20:09 -0500 |

On Feb 6, 2011, at 11:48 PM, Nur Hafidha Hikmayani wrote:

1. Is it at our discretion to adjust to rep78=3 (from your example) considering perhaps that the 'risk' is higher at rep78=3, or was the choice based on the largest proportion?

2. Why Stata gave error mesage when another numerical variable wasadded:adjust weight=3138.575 turn=40.33816 _Irep78_2=0 _Irep78_3=1 _Irep78_4=0 _Irep78_5=0, by(foreign) ci se

I assume you first ran: "xi: svy: reg mpg weight turn i.foreign i.rep78"

Steve sjsamuels@gmail.com

The method I showed will work for indicator variables too, but I,for one,don't understand what is represented when indicators for variableswith >2categories are set to their means. (-svy: prop- won't help, as for kcategories, it gives k proportions). Much better, I think, to setthe othercategorical variables to typical values. e.g., for the auto dataset:xi: svy: reg mpg weight i.foreign i.rep78 // adjust to rep78=3adjust weight=3138.575 _Irep78_2=0 _Irep78_3=1 _Irep78_4=0_Irep78_5=0,by(foreign)For non-linear models like -logistic-, setting variables to theirmeans canproduce unexpected results. See:http://www.stata.com/statalist/archive/2010-07/msg01596.html andMichaelNorman Mitchell's follow-up.Note: Your original formulation in -mfx- looks incomplete. Youspecified"at_Imedgrp_1=0 _Imedgrp_2=0" But medgrp had four levels,( 0,1,2,3),since-xi- produced three indicator variables. Your specification wasequivalentto saying: at medgrp==0 or medgrp==3. Is this what you intended? Steve On Feb 6, 2011, at 9:59 AM, Nur Hafidha Hikmayani wrote: Thanks Steve. I'm afraid however that I'm not clear enough when some independent variables are categorical. You gave an example in which weight and turn are numerical variables - in my case, there is only 1 numerical IV. Suppose foreign is the main IV of interest and other covariates are mostly categorical, can we use -adjust- too (perhaps with -svy:prop- beforehand instead)? hafida-On Sun, Feb 6, 2011 at 9:12 PM, Steven Samuels <sjsamuels@gmail.com>wrote:Nur-I apologize. I checked and discovered -adjust- after -svy: reg-does notcompute predictions at the weighted means of the covariates, onlyat theunweighted means. As a work-around, you could substitute the weighted means by hand. **************************** sysuse auto, clear drop if rep78==. svyset rep78 [pw=head] svy: mean weight turn //get survey weighted means xi: svy: reg mpg weight turn i.foreign adjust weight= 3138.575 turn=40.33816, by(foreign) ci se ***************************** Steve sjsamuels@gmail.com Nur- Use -adjust- with the -ci- option. The fitted value of y is not a "marginaleffect"; for -regress- or (-svy: regress-) the default marginaleffectsare the regression coefficients. ********************* sysuse auto, clear xi: reg weight price turn i.foreign adjust price turn, by(foreign), se ci ****************** Steve sjsamuels@gmail.com On Feb 6, 2011, at 7:02 AM, Nur Hafidha Hikmayani wrote: Dear all, I've been running some regression models using -svy- and estimating its marginal effect using -mfx- (I use Stata 10.1). I wonder how can I get the 95% CI for the marginal effects (y)? The output for regression and its marginal effect are as follows: . xi: svy: reg GH i.medgrp exgrp chronic nummed gp ------------------------------------------------------------------------------ | LinearizedGH | Coef. Std. Err. t P>|t| [95% Conf.Interval]-------------+----------------------------------------------------------------_Imedgrp_1 | 4.429839 3.56263 1.24 0.214 -2.564628 11.42431 _Imedgrp_2 | 8.333728 3.633545 2.29 0.022 1.200035 15.46742 _Imedgrp_3 | 10.05818 3.773961 2.67 0.008 2.648813 17.46755exgrp | -8.916839 1.89046 -4.72 0.000 -12.62835-5.205324chronic | -10.31767 1.936802 -5.33 0.000 -14.12017-6.515169nummed | -1.063043 .3452676 -3.08 0.002 -1.740902 -.3851831gp | -4.347845 1.773649 -2.45 0.014 -7.830027 -.865663_cons | 83.19335 3.520136 23.63 0.000 76.2823190.10438------------------------------------------------------------------------------ . mfx, at(mean _Imedgrp_1=0 _Imedgrp_2=0) Marginal effects after svy:regress y = Fitted values (predict) = 53.085624 ------------------------------------------------------------------------------ variable | dy/dx Std. Err. z P>|z| [ 95% C.I. ] X---------+--------------------------------------------------------------------_Imedg~1*| 4.429839 3.56263 1.24 0.214 -2.55279 11.4125 0 _Imedg~2*| 8.333728 3.63354 2.29 0.022 1.21211 15.4553 .379185 _Imedg~3*| 10.05818 3.77396 2.67 0.008 2.66136 17.455 0 exgrp*| -8.916839 1.89046 -4.72 0.000 -12.6221 -5.21161 .762312 chronic*| -10.31767 1.9368 -5.33 0.000 -14.1137 -6.52161 .83752 nummed | -1.063043 .34527 -3.08 0.002 -1.73975 -.386331 6.69376gp*| -4.347845 1.77365 -2.45 0.014 -7.82413 -.871558 .472814------------------------------------------------------------------------------ (*) dy/dx is for discrete change of dummy variable from 0 to 1 Any help is much appreciated, Thanks, hafida- * * 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/ * * 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/* * 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/ * * 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/

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

**References**:**st: Obtaining 95%CI for marginal effect***From:*Nur Hafidha Hikmayani <nhhikmayani@gmail.com>

**Re: st: Obtaining 95%CI for marginal effect***From:*Steven Samuels <sjsamuels@gmail.com>

**Re: st: Obtaining 95%CI for marginal effect***From:*Nur Hafidha Hikmayani <nhhikmayani@gmail.com>

**Re: st: Obtaining 95%CI for marginal effect***From:*Steven Samuels <sjsamuels@gmail.com>

**Re: st: Obtaining 95%CI for marginal effect***From:*Nur Hafidha Hikmayani <nhhikmayani@gmail.com>

- Prev by Date:
**Re: st: rename middle parts of variables** - Next by Date:
**re: st: xtivreg(2)** - Previous by thread:
**Re: st: Obtaining 95%CI for marginal effect** - Next by thread:
**Re: st: Obtaining 95%CI for marginal effect** - Index(es):