# Shapiro test and transformation

I am playing with shapiro.test from R and checking for non-normality of error variance.

> shapiro.test(residuals(fit))

Shapiro-Wilk normality test

data:  residuals(fit)
W = 0.9525, p-value = 0.0003303

> shapiro.test(residuals( lm( sqrt(V1)~V2 ,data=market) ) )

Shapiro-Wilk normality test

data:  residuals(lm(sqrt(V1) ~ V2, data = market))
W = 0.8895, p-value = 5.89e-08

> shapiro.test(residuals( lm( log(V1)~V2 ,data=market) ) )

Shapiro-Wilk normality test

data:  residuals(lm(log(V1) ~ V2, data = market))
W = 0.7698, p-value = 1.95e-12

> shapiro.test(residuals( lm( 1/(V1) ~ V2 ,data=market) ) )

Shapiro-Wilk normality test

data:  residuals(lm(1/(V1) ~ V2, data = market))
W = 0.3954, p-value < 2.2e-16


The p-value for normality test is <0.001. So I did a transformation on V1, log(Y), inverse(Y) and sqrt(Y) but their p-values gets even smaller. Does this mean that these transformations don't work? I also did a boxcox transformation, and I get p-value of 0.3. So in that case, boxcox is the best remedy only in this case? Or should I just use boxcox in the future for remedy of non-normality? The rest of the usual transformation methods are useless?

1) Why are you transforming the residuals?

2) why are you testing them for normality?

3) what do you mean by 'did a boxcar'? [Resolved]

4) what do the data look like? e.g. what does a QQ plot show?

--

Log, inverse and sqrt are all Box-Cox transformations (up to linear rescaling). Transformation may not be the best idea, but taking transformation as a given, rather than just throw transformations and data and hoping one sticks, find out what your data look like!

• hi, 1) because there's a non-normal behaviour. 2) just an exercise. 3) boxcar transformation. 4) because this is just a simple exercise, what I need to do is just do my own "analysis". There is no "right or wrong" answers. – dorothy Mar 12 '13 at 7:12
• What's a boxcar transformation? Are you talking about some form of PIT? Rank transformation? Something else? You may be doing 'just an exercise' - and you might test for the practice whether it makes sense or not, but it still may be worth pondering whether it makes sense to test it. Can you give some kind of idea for (4) above? – Glen_b Mar 12 '13 at 7:20
• To clarify one of my earlier points, if your residuals are non-normal, and for whatever reason you decide that transformation is called for, it will be the data, not the residuals that you transform. – Glen_b Mar 12 '13 at 7:22
• hi thanks for replying. sorry i mistyped, its boxcox transformation . pareonline.net/pdf/v15n12.pdf – dorothy Mar 12 '13 at 7:40