turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- -->(BOX-COX) Transformation breaks down for large ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-07-2013 05:06 AM

Hi,

I have done a box-cox transformation of my response variable, using the following formula: (Y^lambda - 1)/lambda

Previously, I have got some excellent help in understanding the way interpretation works for different levels of Y (q1,median,q3). My formula for inverse transformation is:

x=(lambda*z + 1)^(1/lamda)

In my analysis, lambda= -1

My interpretation of this formula is that z=y+x (the response times the specific coefficient value). Or just z=y which would return the original values if the response variable.

In short, this works very well. When z=y the back-transformation produces almost the same values as the original.

But a problem arises with one of the beta-coefficients. It is to large, so that z>1 (or, y+x>1 in the transformed scale).

That returns negative values for the back-transformed value of y with respect to x. Does anyone knows how to deal with this problem?

As an example:

Back-transformed values of Y (very close to the real data):

Q1: | Q2: | Q3: |

353,04077 | 403,8761 | 496,2258 |

After the effect of X1, holding the other variables constant (producing plausible results):

Q1: | Q2: | Q3: |

331,2585 | 373,374179 | 450,9129 |

After the effect of X2 (inplausible results):

Q1: | Q2: | Q3: |

-428,079 | -373,61786 | -318,767 |

Does anyone know how to interpret these results, regarding X2, and hopefully has any remedial actions to suggest?

Another question I am searching an answer to, is how to correctly describe the change process?

If the beta-value is -0,00019481 (in transformed scale), and its effect to y varies between 6-9% with different values of y (quantile 1-3 in back-transformed, original scale), how do I describe the change process with respect to a change in x?

Is it correct to describe the change in Y as an interval of 6-9% depending on the value of Y, **with respect to a unit change in X? **It is this last part of the sentence that I is still not certain about..

Any input is much appreciated! I have searched the webb for any material to read about interpreting back-transformed boc-cox transformation, but although there is plenty to read about the method of transforming, interpretation and inverse transformation is rarely mentioned.

Best regards,

Hank

Accepted Solutions

Solution

06-19-2013
01:18 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-19-2013 01:18 PM

No. I am not making my point, so I will try again.

I assume that X1, X2, X3 are in a model that looks like (in PROC TRANSREG);

model BoxCox(Y/ lambda=-2 to 2 by 0.1) = Identity(X1 X2 X3); /* This fits a Box-Cox transformed response variable to X1, X2, and X3, with no transformation on the right hand side */

To look at the effect of X1, you run into a problem when you start examining the back transformed Y values with respect to changes in X1. X2 and X3 will have different moderating effects on X1, depending on their respective values.

Start by selecting low, medium and high values of X1 through X3. This should be based on your knowledge of the ranges of these values. To examine the response of Y to X1, you will need to look at 9 combinations of X2 and X3 (LL, LM, LH, ML, MM, MH, HL, HM, HH, where L=low value for given X, M=medium value, H=high value).

Plug in these and get the X*beta for each.

Subtract the value of these fixed levels from the transformed Y value.

The left hand side is now (transformed Y - other X effects at a given level). Call this Yprime. You may now use the backtransformation on Yprime to look at the effect of X1, as you have now removed all other X effects. Because the backtransformation is non-linear, you should again look at low, medium and high Y values, selecting them from your observed range of responses. Thus for this example, there will be 81 calculations (3^4, 3 levels to the power of three independent plus one dependent variable) to examine. With 7 independent variables, there will be 3^8 = 6561 calculations to examine.

Or you can say that for a unit change of any X(i) variable, the transformed Y will change by beta(i) units, and not be so concerned about changes on the untransformed scale. Relative effect sizes between the various X(i) are monotonically preserved under a Box-Cox transformation.

Steve Denham

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-10-2013 10:23 AM

Hi Hank,

Please share the code you are using. If you are fitting both X1 and X2 as I would expect, you have to run both through the fitted equation to get Y. I suspect, but I could be wrong, that you are checking them one at a time in some way. That is the only way I can think of that the values would change signs.

Steve Denham

Message was edited by: Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-10-2013 03:00 PM

Hi,

Thanks for your reply. I am not sure exactly what kind of code you want, so I share both my SAS-code and the excel-sheet that I use to "translate" the result:

**In SAS:**

proc reg data=work.data1;

PREDICT: model BoxCox-transformed_Y = &untransformed_Xi_(i=1-7) / vif hcc;

title 'Regressions analys (BOX-COX-OLS)';

ID Unit;

run;

quit;

I will try to explain how I have done. You are right that I have checked the transformed values of X1-7 one at a time. But as you can see, when I sum the coefficients X1-7 then

the result is still strange (last row in the table below). I have done the regression without variable X3 which yields better results, but the predicted Y is still way off using my way of calculating things.

My understanding of how to interpret the results was that I should plug in high/median/low values of the response (Y) to see how the Y variable changes in response to

changes in the X variable. So in the table below, I have used the three columns to the right to back-transform the values of the X variables.

I really hope that the table below is at least moderately easy to read. Do you know if I have done it correctly, or where things have gone wrong? or is it just the variable X3 that should not be in the model in the first place?

Best regards,

Hank

**In EXCEL:**

**Inverse (back-transform) of Box-Cox: x=(lambda*z + 1)^(1/lamda)**

**z=(parameter estimate + Box-Cox Transformed Y)**

**lambda= -1**

Variable | Parameter | Heteroscedasticity Consistent | Variance | ||||||

Estimate | Standard | t Value | Pr > |t| | Inflation | Back-transformed: | ||||

Error | Q1(low) | Q2(median) | Q3(high) | ||||||

Intercept | 0,99898 | 0,00026306 | 3797,54 | <,0001 | 0 | ||||

X1 | -0,00000104 | 6,16E-07 | -1,69 | 0,0913 | 1,19167 | 352,9111908 | 403,7066 | 495,9698446 | |

X2 | -0,00022736 | 0,00005738 | -3,96 | <,0001 | 1,09503 | 326,8086987 | 369,9091 | 445,9166403 | |

X3 | 0,0045 | 0,00089063 | 5,06 | <,0001 | 1,62381 | -599,712404 | -494,073 | -402,448758 | |

X4 | -0,00000227 | 6,61E-07 | -3,44 | 0,0007 | 1,33278 | 352,7580653 | 403,5062 | 495,6674662 | |

X5 | 0,00001965 | 0,00001092 | 1,8 | 0,0727 | 1,20388 | 355,5070079 | 407,107 | 501,1120642 | |

X6 | -0,00003239 | 0,00000329 | -9,86 | <,0001 | 1,17605 | 349,0493901 | 398,661 | 488,376251 | |

X7 | -0,00017199 | 0,00003119 | -5,52 | <,0001 | 1,19685 | 332,8314156 | 377,644 | 457,2052221 | |

Sum (w/o intercept): | 0,0040846 | -798,679988 | -621,661 | -483,234567 | |||||

Box-Cox: (Y^lambda - 1)/lambda | |||||||||

Inverse (back-transform) of Box-Cox: x=(lambda*z + 1)^(1/lamda) | |||||||||

Lambda = -1 | |||||||||

| |||||||||

n=330 hccmethod=0 | Real Y-values: | Box-Cox Transformed Y: | |||||||

Q1(low) | 353,04077 | Q1(low) | 0,997167466 | ||||||

Q2(median) | 403,87614 | Q2(median) | 0,997523993 | ||||||

Q3(high) | 496,2258 | Q3(high) | 0,997984788 |

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-11-2013 07:56 AM

OK. The three columns at the right are where you are getting low, medium and high values. They are completely independent of one another, yet in the full model, all seven X variables contribute to the movement of Y. Thus, when you do the calculation, I think you end up plugging in zeroes for the X values which are not being "used". Instead, what happens when you plug in the mean (or median) X values?

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-16-2013 04:50 PM

Hi Steve,

Thanks for your answer, and sorry for the late reply. I have been away travelling. You are totally right, I have not used all the X in the model, but only the one beta coefficient+(low/median/high values of transformed Y) at a time. It feels wrong, and it is wrong as you said. But what do I do instead?

I'm not really sure I understand your question right. By plugging in the mean (or median) X values, do you mean that I sum all the beta coefficients and then back transform, to see the predicted value of Y at different quartiles? In that case, that is what I have done on the last row "sum".

But I quess that you don´t mean that, which leaves me a bit puzzled on which median values you mean? and how can I plug in median values of all X variables and say something about any individual X variable effect?

Thanks, and best regards,

Hank

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-17-2013 09:01 AM

Think about what a multiple regression equation does. A very simple example would be Y = int + b1*X1 +b2*X2. If you wanted to see what the effect of changing X2 has on Y, you have to also insert a value for X1. For simple, nontransformed linear regression, the best value to insert for X1 would be its mean. You could then see the effect on Y at low, medium and high values of X2. The effect will be identical.

Now suppose that you transform on both sides of the equation. To see the effect of changing X2, you need to look at the low, medium and high values of X2, for fixed values of X1. The most meaningful interpretation would be at the median of X1. This can now be extended to an equation with N independent variables. To look at the effect of Xn, you must fix the values of X1 through Xn-1 at some meaningful values. Because the transformation is non-linear, the median of each of the independent variables is a likely candidate. However, you may have other values of interest, based on prior knowledge, or substantive questions.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-19-2013 05:15 AM

Hi,

Your explanation helps to clarify a bit, but what puzzles me is that I don´t have low/medium/high values of the transformed values of Xi, only the beta-coefficients (since the transformation is only in Y, the response variable). How then could I use low/median/high values of something that I don´t have?

Do you mean that I should take low/medium/high values of the untransformed values of X2, then transform the 3 values and substract the X2-beta coefficient -0,00022736 from those values and then add/substract all the other beta-coefficients (X1-X7 excluding X2). Finally, use the formula below?

**x=(lambda*z + 1)^(1/lamda)**

**where z=(transformed X2 (low/medium/high) + (X2-beta parameter estimate) + (sum(X1-X7(excluding X2) beta coefficients))**

**Have I correctly interpret your explanations?**

**Best regards,**

**Hank**

As a reminder of the formulas I used in the table above:

"I have in the table above used:** z=(beta parameter estimate + Box-Cox Transformed Y (low/medium/high)) **which would then explain why its wrong.

Searching online I have found the formula for Box-Cox transformation: **Box-Cox: (Y^lambda - 1)/lambda**

The back transformation, according to formula, is: **x=(lambda*z + 1)^(1/lamda), **

**hence the 'z'-question!"**

Solution

06-19-2013
01:18 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-19-2013 01:18 PM

No. I am not making my point, so I will try again.

I assume that X1, X2, X3 are in a model that looks like (in PROC TRANSREG);

model BoxCox(Y/ lambda=-2 to 2 by 0.1) = Identity(X1 X2 X3); /* This fits a Box-Cox transformed response variable to X1, X2, and X3, with no transformation on the right hand side */

To look at the effect of X1, you run into a problem when you start examining the back transformed Y values with respect to changes in X1. X2 and X3 will have different moderating effects on X1, depending on their respective values.

Start by selecting low, medium and high values of X1 through X3. This should be based on your knowledge of the ranges of these values. To examine the response of Y to X1, you will need to look at 9 combinations of X2 and X3 (LL, LM, LH, ML, MM, MH, HL, HM, HH, where L=low value for given X, M=medium value, H=high value).

Plug in these and get the X*beta for each.

Subtract the value of these fixed levels from the transformed Y value.

The left hand side is now (transformed Y - other X effects at a given level). Call this Yprime. You may now use the backtransformation on Yprime to look at the effect of X1, as you have now removed all other X effects. Because the backtransformation is non-linear, you should again look at low, medium and high Y values, selecting them from your observed range of responses. Thus for this example, there will be 81 calculations (3^4, 3 levels to the power of three independent plus one dependent variable) to examine. With 7 independent variables, there will be 3^8 = 6561 calculations to examine.

Or you can say that for a unit change of any X(i) variable, the transformed Y will change by beta(i) units, and not be so concerned about changes on the untransformed scale. Relative effect sizes between the various X(i) are monotonically preserved under a Box-Cox transformation.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

06-20-2013 02:14 AM

Steve,

Thanks a lot!

Your explanation is superb, and I know now what you meant before writing that the median of the other Xi:s could alternatively be used. This is not the first time you have helped me in my research and for that I thank you. You are a great asset for this forum and the SAS communities!

Best regards,

Hank