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]

Re: st: simple plot of fitted probabilities


From   Tim Wade <[email protected]>
To   [email protected]
Subject   Re: st: simple plot of fitted probabilities
Date   Tue, 4 Jan 2011 16:38:40 -0500

Just to expand a bit on Maarten's suggestion, if you don't want to
-preserve- your data, you can use the -gen- option of -adjust- to
generate a new variable directly in your current dataset. However the
confidence bounds can't be generated directly using -adjust-. To do
this, you actually need  generate the linear predictor and the
standard error, then transform to probabilities and confidence bounds
according to the appropriate model linkage.

e.g., following probit:

adjust rep78 mpg, pr by(price) gen(phat)

or for linear predictor and standard error:

adjust rep78 mpg, xb se by(price) gen(yhat seyhat)


This can also be accomplished using -margins- which is supposed to
replace -adjust-, but it is much more tedious to store the results in
variables. To output the predicted probabilities for each level of
price using -margins- you can use this:


probit foreign price rep78 mpg
levelsof(price), local(x)
margins, atmeans at(price=(`x'))

It has been noted in previous discussions that the standard errors of
probabilities estimated from -adjust- and -margins- don't always
agree.

Hope this helps, Tim




On Tue, Jan 4, 2011 at 4:11 PM, Maarten buis <[email protected]> wrote:
> --- On Tue, 4/1/11, Lloyd Dumont wrote:
>> Say you estimate a very simple probit model…
>>
>> Probit Y X1 X2 X3 X4
>>
>> The ultimate goal is a plot of fitted values
>> (probabilities) in which predicted probability is shown as a
>> function of X1 and all the other independent variables are
>> held at their means.
>>
>> Let’s first say X1 is just a typical continuous variable,
>> say taking on ANY value [0,100] ?
>>
>> Would it make a difference if X1 were a categorical rather
>> than continuous, say taking on only 1,2,3, or 4?
>
> There are many solutions possible, but typically I tend to use
> -adjust- for this type of problem, like this:
>
> *----------- begin example ---------------
> sysuse auto, clear
> probit foreign price rep78 mpg
> preserve
> adjust rep78 mpg, pr by(price) ci replace
> twoway rarea lb ub price, sort || ///
>       line pr price, sort legend(off)
> restore
> *------------- end example ---------------
> (For more on examples I sent to the Statalist see:
> http://www.maartenbuis.nl/example_faq )
>
> This way you automatically deal correctly with continuous
> and categorical variables.
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index