|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: "mfx, predict at(...)" evaluated at CONDITIONAL means?
From |
Christoph Carl Basten <[email protected]> |
To |
[email protected] |
Subject |
Re: st: "mfx, predict at(...)" evaluated at CONDITIONAL means? |
Date |
Sun, 15 Mar 2009 20:57:43 +0100 |
Hi Martin and Eva,
thank you very much for both your proposals, both of which seem to be
working well.
As for Eva's: I earlier considered to do the whole probit only with if
mpg==30, and rejected this because I wanted to use the information
on all units, but adding the if... only at the mfx stage seems to
circumvent this problem.
But Martin's suggestion made me wonder why the following approach does
not also work (it doesn't, I just don't see why):
. sysuse auto, clear
. egen condmean_price = mean(price) if mpg==30
. egen condmean_weight = mean(weight) if mpg==30
. qui probit foreign mpg weight price
. mfx, at(mpg=30 price=`condmean_price' weight=`condmean_weight')
Stata then tells me: 'weight' found where number expected; (and I get
the same error when putting "loc" in front of the two egen commands).
In Martin's solution, no such problem seemed to exist. Could you tell me
what did the trick there?
Many thanks and best regards,
Christoph
Eva Poen wrote:
Christoph,
I haven't had a closer look, but I think there is a very simple
solution for your problem: you can simply use an if condition with
-mfx-. Here is an example using the auto data:
****
sysuse auto
probit foreign mpg rep78 weight
* marginal effects at conditional means of mpg and weight if rep78==3:
mfx compute if rep78==3
* check if the last column really contains conditional means:
sum mpg weight if e(sample) & rep78==3
****
I quickly checked Martin's solution, and it comes to the same results.
Hope this helps,
Eva
2009/3/15 Christoph Carl Basten <[email protected]>:
Hi,
when estimating the marginal effects (using e.g. "mfx") after a Probit
regression, I'd like to set one value (age) to a representative value, say
50 years, and have all other variables at the /conditional/ mean for those
aged 50.
From what I understand, if I specify only "mfx, predict at(age=50), Stata
will set all other variables to the /population/ means, so the only way to
have them set at the means conditional on age=50 would be to compute all
these conditional means by hand and then specifying them manually in the
atlist.
But is there any option to tell Stata that I want age=50 and e.th. else at
the conditional means?
Thanks for your consideration and best regards,
Christoph
*
* 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/