Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: st: AW: why is this graph all over the place?


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: AW: why is this graph all over the place?
Date   Thu, 17 Sep 2009 18:04:19 +0200

<> 

The -prgen- command holds all other covariates at their mean by default, so
my code has already taken care of your concern. To change the -title-s:

*************
sysuse auto, clear
prob for price mpg rep78 /*
*/  headroom trunk weight

ins mpg
loc uniq= r(N_unique)

su mpg, mean
prgen mpg, from(`r(min)')  /*
*/ to(`r(max)') /*
*/ gen(prob) n(`uniq')

tw (connected probp1 probx), /* 
*/ xti("Mpg") ytit("Probability")
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Nirina F
Gesendet: Donnerstag, 17. September 2009 17:55
An: [email protected]
Betreff: Re: st: AW: why is this graph all over the place?

Thank you very much Martin for  your help. It worked so well.

I have a few questions:

is it possible also to graph the marginal effects of just the mpg at
each value of mpg. I know if you calculate
. mfx
after
. prob for price mpg rep78 headroom trunk weight

then you get the marg. effects at the mean value but I would like the
marginal effects at each value of mpg but keeping the other variables
at their mean. I am aware of the -at- option but it's just difficult
to graph it.

Also, How would I change the name of the xaxis and yaxis of the previous
graph?

Thank you very much,

Nrina


On Thu, Sep 17, 2009 at 8:00 AM, Martin Weiss <[email protected]> wrote:
>
> <>
>
> For these purposes, Scott Long`s -findit spost- comes in handy. Of course,
> Long and Freese (2006), http://www.stata-press.com/books/regmodcdvs.html,
is
> the canonical reference for what you are trying to achieve. Try this:
>
>
> *************
> sysuse auto, clear
> prob for price mpg rep78 /*
> */  headroom trunk weight
>
> ins mpg
> loc uniq= r(N_unique)
>
> su mpg, mean
> prgen mpg, from(`r(min)')  /*
> */ to(`r(max)') /*
> */ gen(prob) n(`uniq')
>
> tw (connected probp1 probx)
> *************
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]] Im Auftrag von Nirina F
> Gesendet: Donnerstag, 17. September 2009 13:41
> An: [email protected]
> Betreff: st: why is this graph all over the place?
>
> Dear all,
>
> I would like to graph the predicted probabilities of  having foreign
> against mpg in order to highlight the slope(basically the marginal
> effects) at each value of mpg.
> I run the following but it is all over the place because I think it is
> giving me the predicted probabilities from different variables.
> Could you help me in this please. also if you could help me graph the
> marginal effects of mpg from this probit equation against each value
> of mpg.
>
> probit  foreign price mpg rep78 headroom trunk weight
> predict pmpg, p
> sort mpg
> twoway line  pmpg mpg
>
> Thank you veyr much,
> N
> *
> *   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/



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