/* This program uses an algorithm for performing a one degree of freedom nonadditivity test presented in Oehlerts book "A First Course in Design and Analysis of Experiments" on page 218 This method performs a nonadditivity test and also suggests a power transformation for use when additivity is rejected */ data table617 ; input a b y @@ ; cards ; 1 1 2.1 1 2 6.8 1 3 8.4 1 4 1.4 1 5 14.6 1 6 7.9 1 7 4.8 2 1 1.7 2 2 8.1 2 3 8.4 2 4 1.4 2 5 12.0 2 6 3.7 2 7 4.5 3 1 14.4 3 2 14.8 3 3 27.0 3 4 30.9 3 5 36.5 3 6 36.4 3 7 31.4 4 1 57.4 4 2 62.4 4 3 37.4 4 4 63.3 4 5 65.5 4 6 65.6 4 7 59.8 5 1 66.2 5 2 81.7 5 3 53.3 5 4 80.7 5 5 79.7 5 6 80.8 5 7 82.4 6 1 75.2 6 2 94.0 6 3 74.3 6 4 87.9 6 5 93.3 6 6 87.8 6 7 80.5 7 1 4.1 7 2 10.2 7 3 10.7 7 4 5.5 7 5 18.1 7 6 11.4 7 7 6.1 ; proc print ; run ; * fit a preliminary model, typically an additive model ; proc glm data = table617 ; class a b ; model y = a b ; output out = rtable617 p = pred r = res ; run ; proc plot data = rtable617 ; plot pred*a=b pred*b=a ; run ; * create a new variable equal to the squared predicted value divided by 2 times the mean of the data ; data rtable617a ; set rtable617 ; newvar = pred**2/(2*38.214) ; * refit a model that includes the new variable. The t test for this term is the test for interaction. If interaction is present, then the coefficient for the new variable can be used to suggest a transformation to remove the interaction. The suggested transformation is 1 - betahat, where betahat is the estimated coefficient for the new variable ; proc glm data = rtable617a ; class a b ; model y = a b newvar / solution ; run ; * estimated coefficient is .57, so a recommended transformation is 1 - .57 = .43, close to a square root ; data table617new ; set table617 ; ynew = sqrt(y) ; proc glm data = table617new ; class a b ; model ynew = a b ; output out = rtable617new p = pred r = res ; run ; proc plot data = rtable617new ; plot pred*a=b pred*b=a ; run ; data rtable617newa ; set rtable617new ; newvar = pred**2/(2*5.47) ; * after transformation the nonadditivity test is not significant ; proc glm data = rtable617newa ; class a b ; model ynew = a b newvar / solution ; output out = r2table617newa p = pred r = res ; run ; * check usual assumptions for analysis with transformed data ; data r2table617newa2 ; set r2table617newa ; sqabsresid = sqrt(abs(res)) ; run ; proc plot data = r2table617newa2 ; plot res*pred sqabsresid*pred ; proc capability noprint data = r2table617newa2 lineprinter ; var res ; qqplot res /normal(mu = est sigma = est symbol='.') square ; run ;