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]

AW: st: Conditional Effect Plots after mi estimate


From   <[email protected]>
To   <[email protected]>
Subject   AW: st: Conditional Effect Plots after mi estimate
Date   Sun, 17 Feb 2013 13:00:17 +0000

Thank you very much for the answer. Actually the margins and marginsplot commands do not work after MI. But after a little search I found this website: http://www.ats.ucla.edu/stat/stata/faq/ologit_mi_marginsplot.htm
 
It contains a manual for a workaround, which actually after a few modifications  worked out fine for me. Here is my version of the code:

use mi1502.dta

program emargins, eclass properties(mi) 
  version 12
  args outcome
  logit uebertritt zh sex i.egp4 migerf i.mig schnitt d_cost inc, vce(cluster klasse)
  margins egp4, at (schnitt=(4(.1)6)) atmeans asbalanced post 
end

program myret, rclass
    return add
    return matrix b = b
    return matrix V= V
end


mi estimate: logit  uebertritt  zh sex i.egp4 migerf i.mig schnitt d_cost inc, vce(cluster klasse)


  mi estimate, cmdok: emargins uebertritt // emargins is defined above
  mat b= e(b_mi)                        // save mi point estimates
  mat V = e(V_mi)                       // save mi vce
 
* run ologit and margins on the _mi_m==0 data
  quietly logit uebertritt zh sex i.egp4 migerf i.mig schnitt d_cost inc, vce(cluster klasse)
  quietly margins egp4, at (schnitt=(4(.1)6)) atmeans asbalanced post

  myret                                 // myret is defined above
  mata: st_global("e(cmd)", "margins")  // set previous cmd to margins

  marginsplot, x(schnitt) recast(line) name(logit, replace) xlabel(4 4.5 5 5.5 6) ylabel(0 .25 .50 .75 1) 
________________________________________
Von: [email protected] [[email protected]]&quot; im Auftrag von &quot;Ulrich Kohler [[email protected]]
Gesendet: Sonntag, 17. Februar 2013 11:40
An: [email protected]
Betreff: Re: st: Conditional Effect Plots after mi estimate

I haven't tried it, but my guess would be that the official Stata
commands -margins- and -marginsplot- work after -mi-:

. sysuse auto
. logit for weight length
. margins, at(weight =(1760(100)4840) length=(150(25)225))
. marginsplot, by(length)



Am Samstag, den 16.02.2013, 11:22 +0000 schrieb
[email protected]:
> Dear Stata List Community
>
> After perfoming a Logistic Regression on Educational Transitions like the following:
>
> logit y x1 x2 x3 ... xi, vce(cluster school)
>
> where y is the choice between two different Educational Tracks and xi are the predictor variables (like social class, GPA and migration background), i want to produce conditional effect plots, that are showing the change in transition probabilities for indivuals given certain characteristics for different values of GPA. Thanks to the command 'prgen' this ist pretty easy, my command for that looks like this:
>
> prgen gpa, from (4) to (6) gen (pr1) x (x1 =0 x2=1) rest (mean)
> prgen gpa, from (4) to (6) gen (pr2) x (x1 =1 x2=1) rest (mean)
>
> twoway (scatter pr1p1 pr2p1 pr2px)
>
> Now if I want to do the same with imputed data, the command prgen doesn't work with results from regressions like:
>
> mi estimate: logit y x1 x2 x3 ... xi, vce(cluster school)
>
> There seem to be solutions for similar problems, but not the same problem (e.g. for svy data) and the more I'm searching, the more confused I actually get. Is there a "simple" solution for plotting Conditional Probabilities after mi estimate: logit?
>
> Thanks a lot
> Michael
> *
> *   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/

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