Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: saving marginal effects from oprobit using spost or some other command


From   "Tom Boonen" <[email protected]>
To   [email protected]
Subject   Re: st: saving marginal effects from oprobit using spost or some other command
Date   Fri, 11 Jan 2008 13:46:10 -0500

thank a ton Maatren. this looks great. i also found and ado called
"mfx2", which loops over the categories to produce the predicted
changes for each category.

thanks again,
Tom

On Jan 11, 2008 1:06 PM, Maarten buis <[email protected]> wrote:
> What about this?
>
> *---------- begin example -----------------------
> sysuse auto, clear
> recode rep78 1/2=3
> oprobit rep78 foreign
>
> mfx, predict(pr outcome(#1))
> matrix list e(Xmfx_dydx)
> matrix b = e(Xmfx_dydx)
> matrix se = e(Xmfx_se_dydx)
>
> mfx, predict(pr outcome(#2))
> matrix b = b \ e(Xmfx_dydx)
> matrix se = se \ e(Xmfx_se_dydx)
>
> mfx, predict(pr outcome(#3))
> matrix b = b \ e(Xmfx_dydx)
> matrix se = se \ e(Xmfx_se_dydx)
>
> matrix bci = b - invnormal(.975)*se, b,  b + invnormal(.975)*se
> matrix colnames bci = lb b ub
> matrix rownames bci = outcome1 outcome2 outcome3
> matrix list bci
> drop _all
> svmat bci, names(col)
> gen outcome = _n
> twoway rcap lb ub outcome ||                                ///
>        scatter b outcome ,                                  ///
>        xlab(1 2 3) xscale(range(.5 3.5))                    ///
>        xtitle("outcome")  yline(0)                          ///
>        ytitle("Pr(outcome|foreign)-Pr(outcome|domestic)")   ///
>        legend( order( 2 "point" "estimate"                  ///
>                       1 "95%" "Conf. Int.") )
> exit
> *-------------------- end example --------------------------------
> (For more on how to use examples I sent to the Statalist, see
> http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
>
>
>
> --- Tom Boonen <[email protected]> wrote:
>
> > I have a binary X covariate and a discrete (five category) outcome
> > variable. All i need is a way to store these predcited changes (and
> > most importantly the CIs on the predicted changes). Any help on how
> > to
> > do this is highly appreciated. Spost commands do not seem to provide
> > this functionality.
> >
> > Thanks,
> > Tom
> >
> > On Jan 11, 2008 10:01 AM, Maarten buis <[email protected]>
> > wrote:
> > > --- Tom Boonen <[email protected]> wrote:
> > > > For an ordered probit or logit model, is there any way to save
> > > > marginal effect estimates produced via the suite of spost
> > commands?
> > > > For example:
> > > >
> > > > oprobit Y X1
> > > > prvalue, x(X1=0) save delta
> > > > praccum , using(Xmat) xis(0)
> > > > prvalue, x(X1=1) dif delta
> > > >
> > > > * this produces nice marginal effect estimates (ie. changes in
> > the
> > > > PR(Y=1|X1=0) - PR(Y=1|X1=1)) including CI intervals.
> > >
> > > These are usually called discrete change coefficients, and not
> > marginal
> > > effects. Marginal effects is the first derivative of the
> > probability
> > > curve with respect to x1 evaluated at some value chosen by you.
> > > Discrete change coefficients are the differences between two
> > predicted
> > > probabilities.
> > >
> > > What kind of graph do you want to create (what is on y-axis and
> > > x-axis?)
> > > What kind of explanatory variables do you have (continuous or
> > > categorical)?
> > >
> > > -- Maarten
> > >
> > > -----------------------------------------
> > > Maarten L. Buis
> > > Department of Social Research Methodology
> > > Vrije Universiteit Amsterdam
> > > Boelelaan 1081
> > > 1081 HV Amsterdam
> > > The Netherlands
> > >
> > > visiting address:
> > > Buitenveldertselaan 3 (Metropolitan), room Z434
> > >
> > > +31 20 5986715
> > >
> > > http://home.fsw.vu.nl/m.buis/
> > > -----------------------------------------
> > >
> > >
> > >       __________________________________________________________
> > > Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
> > >
> > >
> > > *
> > > *   For searches and help try:
> > > *   http://www.stata.com/support/faqs/res/findit.html
> > > *   http://www.stata.com/support/statalist/faq
> > > *   http://www.ats.ucla.edu/stat/stata/
> > >
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/support/faqs/res/findit.html
> > *   http://www.stata.com/support/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> >
>
>
> -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
>
> visiting address:
> Buitenveldertselaan 3 (Metropolitan), room Z434
>
> +31 20 5986715
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
>
>       __________________________________________________________
> Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index