Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: prvalue with many dummy variables

 From Richard Williams To statalist@hsphsun2.harvard.edu, "statalist@hsphsun2.harvard.edu" Subject Re: st: prvalue with many dummy variables Date Sun, 11 Mar 2012 11:06:58 -0500

```At 10:30 PM 3/10/2012, Vitorino, Maria Ana wrote:
```
```Dear Statalist members,

If I fit a logit model with many dummy variables such as:

logit pass sex age school_d*

```
where school_d* includes dummies for schools numbered from 1 to 20, i.e. school_d1, school_d2, ,,,, school_d20
```
```
how can I calculate a predicted probability without having to specify values for all the 19 schools that take value 0?
```
For example, suppose I want to do something like
prvalue x(sex=1 age=20 school_d1=1 school_d2=0 school_d3=0  etc)

```
Is there a way of not having to write in the command line above that school_d[i]=0 for every i other than 1?
```
```
Like Joseph says, -margins- is the way to go. And if you have Stata 12, -marginsplot- can be very helpful for graphing the results. For more on margins, see
```
http://www.nd.edu/~rwilliam/stats/Margins01.pdf

```
If you want predicted probabilities for all 20 schools, I would tweak Joseph's example and make it
```
margins school , at(sex=1 age=20)

```
With margins it is also easy to plug in different values for sex and age if you want, e.g. have age range between 20 and 30 or whatever is reasonable. The output can be hard to read (because there can be so much of it) but -marginsplot- can help make it more intelligible.
```

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

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