Presentation is loading. Please wait.

Presentation is loading. Please wait.

AOV Assumption Checking and Transformations (§ )

Similar presentations


Presentation on theme: "AOV Assumption Checking and Transformations (§ )"— Presentation transcript:

1 AOV Assumption Checking and Transformations (§8.4-8.5)
How do we check the Normality of residuals assumption in AOV? How do we check the Homogeneity of variances assumption in AOV? (§7.4) What to do if these assumptions are not met?

2 Model Assumptions Homoscedasticity (common group variances).
Normality of residuals. Independence of residuals. (Hopefully achieved through randomization.) Effect additivity. (Only an issue in multi-way AOV; later).

3 Checking the Equal Variance Assumption
HA: some of the variances are different from each other Little work but little power Hartley’s Test: A logical extension of the F test for t=2. Requires equal replication, n, among groups. Requires normality. Reject if Fmax > Fa,t,n-1, tabulated in Table 12.

4 Bartlett’s Test More work but better power T.S.
Bartlett’s Test: Allows unequal replication, but requires normality. T.S. If C > c2(t-1),a then apply the correction term Reject if C/CF > c2(t-1),a R.R.

5 Levene’s Test More work but powerful result. Let T.S. df1 = t -1
= sample median of i-th group T.S. df1 = t -1 df2 = nT - t R.R. Reject H0 if Use Table 8. Essentially an AOV on the zij

6 Minitab Stat > ANOVA > Test for Equal Variances
Response Resist Factors Sand ConfLvl Bonferroni confidence intervals for standard deviations Lower Sigma Upper N Factor Levels Bartlett's Test (normal distribution) Test Statistic: 1.890 P-Value : 0.756 Levene's Test (any continuous distribution) Test Statistic: 0.463 P-Value : 0.762 Minitab Stat > ANOVA > Test for Equal Variances Minitab Help Use Bartlett’s test when the data come from normal distributions; Bartlett’s test is not robust to departures from normality. Use Levene’s test when the data come from continuous, but not necessarily normal, distributions. The computational method for Levene’s Test is a modification of Levene’s procedure [10] developed by [2]. This method considers the distances of the observations from their sample median rather than their sample mean. Using the sample median rather than the sample mean makes the test more robust for smaller samples. Do not reject H0 since p-value > 0.05 (traditional a)

7

8 SAS Program proc glm data=stress; class sand; model resistance = sand / solution; means sand / hovtest=bartlett; means sand / hovtest=levene(type=abs); means sand / hovtest=levene(type=square); means sand / hovtest=bf; /* Brown and Forsythe mod of Levene */ title1 'Compression resistance in concrete beams as'; title2 ' a function of percent sand in the mix'; run; Hovtest only works when one factor in (right hand side) model.

9 SAS hovtest=bartlett; hovtest=levene(type=abs);
Bartlett's Test for Homogeneity of resistance Variance Source DF Chi-Square Pr > ChiSq sand SAS Levene's Test for Homogeneity of resistance Variance ANOVA of Absolute Deviations from Group Means Sum of Mean Source DF Squares Square F Value Pr > F sand Error hovtest=levene(type=abs); Levene's Test for Homogeneity of resistance Variance ANOVA of Squared Deviations from Group Means Sum of Mean Source DF Squares Square F Value Pr > F sand Error hovtest=levene(type=square); Brown and Forsythe's Test for Homogeneity of resistance Variance ANOVA of Absolute Deviations from Group Medians Sum of Mean Source DF Squares Square F Value Pr > F sand Error hovtest=bf;

10 SPSS Test of Homogeneity of Variances RESIST .947 4 20 .457 Levene
Statistic df1 df2 Sig. Since the p-value (0.457) is greater than our (typical) a =0.05 Type I error risk level, we do not reject the null hypothesis. This is Levene’s original test in which the zij are centered on group means and not medians.

11 R Tests of Homogeneity of Variances bartlett.test(): Bartlett’s Test.
fligner.test(): Fligner-Killeen Test (nonparametric).

12 Checking for Normality
Reminder: Normality of the RESIDUALS is assumed. The original data are assumed normal also, but each group may have a different mean if HA is true. Practice is to first fit the model, THEN output the residuals, then test for normality of the residuals. This APPROACH is always correct. TOOLS Histogram of all residuals (eij). Normal probability (Q-Q) plot. Formal test for normality.

13 Histogram of Residuals
proc glm data=stress; class sand; model resistance = sand / solution; output out=resid r=r_resis p=p_resis ; title1 'Compression resistance in concrete beams as'; title2 ' a function of percent sand in the mix'; run; proc capability data=resid; histogram r_resis / normal; ppplot r_resis / normal square ;

14 Probability Plots A scatter plot of the percentiles on the residuals versus the percentiles of a standard normal distribution. The basic idea is that if the residuals are truly normally distributed, values for these percentiles should lie on a straight line. Compute and sort the residuals e(1), e(2),…, e(n). Associate to each residual a standard normal percentile. [ z(i) = normsinv((i-.5)/n)]. Plot z(i) versus e(i). Compare to straight line (don’t care so much about which line).

15 Spreadsheet & R In EXCEL: scatterplot of
percentile versus Normal percentile. Use AddLine option. Percentile pi = (i-0.5)/n Normal percentile =NORMSINV(pi) In R with residuals in “y”: qqnorm(y) qqline(y)

16 Excel Probability Plot

17 Probability Plot Minitab SAS (note axes changed) These look normal!

18 Formal Normality Tests
Many, many tests (a favorite pass-time of statisticians is developing new tests for normality.) Kolmogorov-Smirnov test. Shapiro-Wilks test (n < 50). D’Agostino’s test (n>=50) All quite conservative – they fail to reject the null hypothesis of normality more often than they should.

19 Shapiro-Wilk’s W test e1, e2, …, en represent data ranked from smallest to largest. H0: The population has a normal distribution. HA: The population does not have a normal distribution. T.S. Coefficients ai come from a table. If n is even R.R. Reject H0 if W < W0.05 If n is odd. Critical values of Wa come from a table.

20 Shapiro-Wilk Coefficients

21 Shapiro-Wilk Coefficients

22 Shapiro-Wilk W Table

23 D’Agostino’s Test e1, e2, …, en represent data ranked from smallest to largest. H0: The population has a normal distribution. HA: The population does not have a normal distribution. T.S. R.R. (two sided test) Reject H0 if Y0.025 and Y0.975 come from a table of percentiles of the Y statistic.

24

25 Transformations to Achieve Homoscedasticity
What can we do if the homoscedasticity (equal variances) assumption is rejected? Declare that the AOV model is not an adequate model for the data. Look for alternative models. (Later.) Try to “cheat” by forcing the data be homoscedastic through a transformation of the response variable Y. (Variance Stabilizing Transformations.)

26 Square Root Transformation
Response is positive and continuous. This transformation works when we notice the variance changes as a linear function of the mean. k>0 Useful for count data (Poisson Distributed). For small values of Y, use Y+.5. Typical use: Counts of items when counts are between 0 and 10.

27 Logarithmic Transformation
Response is positive and continuous. This transformation tends to work when the variance is a linear function of the square of the mean k>0 Replace Y by Y+1 if zero occurs. Useful if effects are multiplicative (later). Useful If there is considerable heterogeneity in the data. Typical use: Growth over time. Concentrations. Counts of times when counts are greater than 10.

28 ARCSINE SQUARE ROOT Response is a proportion.
With proportions, the variance is a linear function of the mean times (1-mean) where the sample mean is the expected proportion. Y is a proportion (decimal between 0 and 1). Zero counts should be replaced by 1/4, and N by N-1/4 before converting to percentages Typical use: Proportion of seeds germinating. Proportion responding.

29 Reciprocal Transformation
Response is positive and continuous. This transformation works when the variance is a linear function of the fourth root of the mean. Use Y+1 if zero occurs. Useful if the reciprocal of the original scale has meaning. Typical use: Survival time.

30 Power Family of Transformations (1)
Suppose we apply the power transformation: Suppose the true situation is that the variance is proportional to the k-th power of the mean. In the transformed variable we will have: If p is taken as 1-k, then the variance of Z will not depend on the mean, i.e. the variance will be constant. This is a Variance stabilizing transformation.

31 Power Family of Transformations (2)
With replicated data, k can sometimes be found empirically by fitting: Estimate: k can be estimated by least squares (regression – Next Unit). If is zero use the logarithmic transformation.

32 Box and Cox Transformations
suggested transformation geometric mean of the original data. Exponent, l, is unknown. Hence the model can be viewed as having an additional parameter which must be estimated (choose the value of l that minimizes the residual sum of squares).

33 Handling Heterogeneity
no Regression? ANOVA yes Fit Effect Model Fit linear model accept OK Test for Homoscedasticity Plot residuals reject Not OK Transform OK Box/Cox Family Power Family Traditional Transformed Data

34 Transformations to Achieve Normality
Regression? ANOVA yes Fit linear model Estimate group means Probability plot Formal Tests yes OK Residuals Normal? no Transform Different Model


Download ppt "AOV Assumption Checking and Transformations (§ )"

Similar presentations


Ads by Google