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

# Re: st: Marginsplot on backtransformed data

 From Richard Williams To statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu Subject Re: st: Marginsplot on backtransformed data Date Thu, 19 Dec 2013 11:13:58 -0500

```At 10:50 AM 12/19/2013, Scott Merryman wrote:
```
```One could also use the -expression()- option in -margins-

margins race, expression(predict(xb)^2)
marginsplot, name(regress2,replace)
```
```
```
Good point. I've used the expression option to do thing like multiply numbers by 100 so you get 37.3 instead of .373.
```
```
That still leaves open the question of whether you should use regress (computing the square root of the dv yourself) or use glm (using the power link.) In my example it doesn't make too much difference. In general is it better to use glm or are there pros and cons of each approach?
```
```
```Scott

On Thu, Dec 19, 2013 at 9:30 AM, Richard Williams
<richardwilliams.ndu@gmail.com> wrote:
> Patrick Royston's -marginscontplot- (available from SSC) can be used when
> you've done a log or other transformation of an independent variable. See
> the help file example entitled "Example using a log-transformed covariate".
>
```
> For a dependent variable, I think you can use the glm command, at least some
```> of the time. You should get a 2nd opinion on this, e.g. Austin Nichols is
> much better with these sorts of things than I am. When the dependent
> variable has been transformed I believe it is often better to use glm
```
> anyway. In the following you don't get exactly the same results from regress > and glm but I don't think you are supposed to (and the results are similar).
```>
> webuse nhanes2f, clear
> gen sqweight = weight ^.5
> reg sqweight i.race
> margins race
> marginsplot, name(regress)
> glm weight i.race, link(power .5)
> margins race
> marginsplot, name(glm)
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```
```
-------------------------------------------
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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```