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

Re: st: prvalue and loop rest(grmean)

 From Richard Williams To statalist@hsphsun2.harvard.edu Subject Re: st: prvalue and loop rest(grmean) Date Thu, 27 Oct 2011 09:03:08 -0500

```At 04:50 AM 10/27/2011, Tobias Schlager wrote:
```
```Dear List,

I have a question regarding following problem, it would be amazing if
anybody knows a solution.

I am using prvalue to estimate the difference in the probability between 2

situations. However, the function is nonlinear (cubic) and I implemented a

loop to do that.
My problem now is that rest(grmean) is not working with the loop, does
anybody know by any chance a work-around?
```
```
```
What do you mean by "does not work?" Are you getting error messages, or do you think the results are wrong (and if so why?) Does it work when not in a loop?
```
```
I don't understand why you are using grmean. Long gives the example of x(female=0) rest(grmean). That means that other vars get assigned to the male means. What kind of groups are defined by your specifications? Do groups with those values even exist? In any event realize that if your code works, different means are getting plugged in each time, which will affect any comparisons you do. You could probably compute those means yourself and then explicitly plug them in.
```
I wonder if life wouldn't be a lot easier if you used the -margins- command.

```
Finally, I assume you are using the latest and greatest version of -prvalue-, which is part of the Long and Freese -spost9- suite of commands. The most current version is
```
. which prvalue
*! version 2.5.4 2010-03-26

```
```Here is what I tried so far by hand:

logit y z x v w a b b^2 b^3 c c^2 c^3, robust
matrix brisk_1 = J(11,4,.)
matrix colnames brisk_1 = x dc1 dc1LB dc1UB
prvalue, x(a=0 b=-5 b^2=25 b^3 =-125) rest(grmean) save label(single)
prvalue, x(a=1 b=-5 b^2=25 b^3=-125) rest(grmean) diff label(multiple)
matrix brisk_1[1,1] = -5
matrix brisk_1[1,2] = pepred[6,2]
matrix brisk_1[1,3] = pelower[6,2]
matrix brisk_1[1,4] = peupper[6,2]
prvalue, x(a=0 b=-4 b^2=16 b^3=-64) rest(grmean) save label(single)
prvalue, x(a=1 b=-4 b^2=16 b^3=-64) rest(grmean) diff label(multiple)
matrix brisk_1[2,1] = -4
matrix brisk_1[2,2] = pepred[6,2]
matrix brisk_1[2,3] = pelower[6,2]
matrix brisk_1[2,4] = peupper[6,2]
prvalue, x(a=0 b=-3 b^2=9 b^3=-27) rest(grmean) save label(single)
prvalue, x(a=1 b=-3 b^2=9 b^3=-27) rest(grmean) diff label(multiple)
matrix brisk_1[3,1] = -3
matrix brisk_1[3,2] = pepred[6,2]
matrix brisk_1[3,3] = pelower[6,2]
matrix brisk_1[3,4] = peupper[6,2]
```
```
-------------------------------------------
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/
```