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 Subject Re: st: Marginsplot on backtransformed data Date Thu, 19 Dec 2013 10:30:25 -0500

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)
margins race
marginsplot, name(glm)

At 01:58 AM 12/19/2013, you wrote:
```
```Hi All,

I am using the marginsplot function to plot graphs that take into
account adjustments I have carried out following a regression
analysis. Since my regression analysis contains data that has been
normalised by square root transformation, the plots are not that
easily interpretable. Is there a way to plot the same graphs but
somehow tell Stata/marginsplot to use back-transformed results? And
does the margins function store predictions that can be accessed?

I am using Stata 13 and the following are examples of commands I am using:

regress squareroot_transformed_variable i.categorical1 i.categorical2

margins categorical1

marginsplot

Kind Regards
Herbert
*
*   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/
```