BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hank
Fluorite | Level 6

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,04077403,8761496,2258

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

Q1:Q2:Q3:
331,2585373,374179450,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! Smiley Happy 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

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

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

View solution in original post

8 REPLIES 8
SteveDenham
Jade | Level 19

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

Hank
Fluorite | Level 6

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

VariableParameterHeteroscedasticity ConsistentVariance
EstimateStandardt ValuePr > |t|InflationBack-transformed:
ErrorQ1(low)Q2(median)Q3(high)
Intercept0,998980,000263063797,54<,00010
X1-0,000001046,16E-07-1,690,09131,19167352,9111908403,7066495,9698446
X2-0,000227360,00005738-3,96<,00011,09503326,8086987369,9091445,9166403
X30,00450,000890635,06<,00011,62381-599,712404-494,073-402,448758
X4-0,000002276,61E-07-3,440,00071,33278352,7580653403,5062495,6674662
X50,000019650,000010921,80,07271,20388355,5070079407,107501,1120642
X6-0,000032390,00000329-9,86<,00011,17605349,0493901398,661488,376251
X7-0,000171990,00003119-5,52<,00011,19685332,8314156377,644457,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
z=(parameter estimate + Box-Cox Transformed Y)
n=330 hccmethod=0Real Y-values:Box-Cox Transformed Y:
Q1(low)353,04077Q1(low)0,997167466
Q2(median)403,87614Q2(median)0,997523993
Q3(high)496,2258Q3(high)0,997984788
SteveDenham
Jade | Level 19

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

Hank
Fluorite | Level 6

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

SteveDenham
Jade | Level 19

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

Hank
Fluorite | Level 6

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!"

SteveDenham
Jade | Level 19

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

Hank
Fluorite | Level 6

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 4460 views
  • 7 likes
  • 2 in conversation